Avatar billede tjalle Nybegynder
12. september 2002 - 14:24 Der er 3 kommentarer og
1 løsning

explode...

Hej;

i PHP har man :
explode(" ", $string)

denne tager en streng og opdeler den i et array hvor hvert ord bliver en selvstændig node i arrayet..

Hvordan gøres dette i .net ??

Tj.
Avatar billede a1a1 Novice
12. september 2002 - 14:35 #1
split :)
Avatar billede a1a1 Novice
12. september 2002 - 14:37 #2
string.split(

Identifies the substrings in this instance that are delimited by one or more characters specified in an array, then places the substrings into a String array.

Overload List
Identifies the substrings in this instance that are delimited by one or more characters specified in an array, then places the substrings into a String array.

[Visual Basic] Overloads Public Function Split(ParamArray Char()) As String()
[C#] public string[] Split(params char[]);
[C++] public: String* Split(__wchar_t __gc[]) __gc[];

Identifies the substrings in this instance that are delimited by one or more characters specified in an array, then places the substrings into a String array. A parameter specifies the maximum number of array elements to return.

[Visual Basic] Overloads Public Function Split(Char(), Integer) As String()
Avatar billede a1a1 Novice
12. september 2002 - 14:40 #3
vb

Dim myString As String = "Look at these!"
' Returns ["Look", "at", "these!"]
Dim myArray() As String = Split(myString)

Function Split(
  ByVal Expression As String,
  Optional ByVal Delimiter As String = " ",
  Optional ByVal Limit As Integer = -1,
  Optional ByVal Compare As CompareMethod = CompareMethod.Binary
) As String()

dvs hvis det ikke er " " du vil splitte på så hedder det noget ala
Split(myString, ",") ' split på komma
Avatar billede tjalle Nybegynder
13. september 2002 - 09:53 #4
mange tak...
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester