Results 1 to 6 of 6

Thread: C# ช่วยทีค่ะ

  1. #1
    Junior Member
    Join Date
    Jul 2007
    Posts
    28


    ขอคอนเซปหรือโค๊ดในการ spite คำหน่อยได้ไหมค่ะ การตัดคำอ่าค่ะของ C# ค่ะ ขอความกรุณาด้วยนะค่ะ

  2. #2


    ไม่แน่ใจว่าตอบตรงคำถามหรือเปล่าว่า ใน C# มันมีfunction ในการ split มาให้อยู่แล้วนี่นา
    อย่างเช่น
    string strTemp = "Hello World";
    string[] arrTmp = strTemp.Split(' '

  3. #3
    Junior Member
    Join Date
    Jul 2007
    Posts
    28


    ขอบคุณมากค่ะทำได้เเย้ว
    อิอิ ขอบคุงมากๆนะค่ะ

  4. #4
    Junior Member
    Join Date
    Apr 2008
    Posts
    16


    คำตอบนั้น ผมว่า ง่ายๆครับ การตัดคำของ string ใน c# นั้น
    จะดีอยู่อย่างคือมี namespace เฉพาะการใช้งานของมันเลยครับ รู้สึกจะเป็น system.stringมั่ง จำไม่ค่อยได้
    มันจะเก็บพวก property method ทั้งหมดเลยครับ
    ถ้ายังใช้ไม่เป็น แนะให้ใช้ msdn หรือถ้าไม่ได้ไง pm มาหาผมก้อได้ครับ พอดีพอเป็นอยู่

  5. #5
    Jedi Global Moderator
    Join Date
    Aug 2007
    Location
    Bangkok
    Posts
    136


    อันนี้เป็น Code ที่ใช้ในการตัด String ที่เขียนเป็น Class ครับผม สั่ง Return ค่าเป็น Array List ก็ได้ครับ
    ผมเอา Code ตัวนี้ไปใช้ สร้าง Static Class สำหรับตัด String
    [hide=1][code]using System;

    class MainClass
    {
    private string splitString = "1,2,3,4,5,6";
    private char[] sep = {','};
    public static void Main(string[] args)
    {

  6. #6
    Junior Member
    Join Date
    May 2008
    Posts
    6


    การสปริตไม่แน่ใจว่าคือการ แตกข้อความที่รับเข้ามาโดยแบ่งโดยช่องว่าเช่น
    hello world พอ split จะได้ hello กับคำว่า world โดยเวลาสปริตก็สามาถรแตกลง array ได้

Members who have read this thread : 0

Actions : (View-Readers)

There are no names to display.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •