 |
|
[.NET]
สอบถามเรื่องการแบ่งคำ โดยใช้ Character เป็น key หน่อยครับ |
|
 |
|
|
 |
 |
|
ลองดูโค้ดนี้เป็นตัวอย่างครับ
using System;
public class Example
{
public static void Main()
{
string[] separators = {",", ".", "!", "?", ";", ":", " "};
string value = "The handsome, energetic, young dog was playing with his smaller, more lethargic litter mate.";
string[] words = value.Split(separators, StringSplitOptions.RemoveEmptyEntries);
foreach (var word in words)
Console.WriteLine(word);
}
}
// The example displays the following output:
// The
// handsome
// energetic
// young
// dog
// was
// playing
// with
// his
// smaller
// more
// lethargic
// litter
// mate
|
 |
 |
 |
 |
Date :
2018-06-27 17:40:20 |
By :
Rashun |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|