split "C:\hello" "C:\h\ddd"
-
when you have string "C:\my fodler\hello" "C:\Documents and Settings\admin\" is given, how can I use the function split to separate this string and convert into an array. "C:\my fodler\hello" "C:\Documents and Settings\admin\" I have try with Chr$(22) which is the space btwn double quotation, but seemslike it can't find the space btwn. Also I have to be aware of those space for path"My Folder". Probably easy for others. Thanks Shin
-
when you have string "C:\my fodler\hello" "C:\Documents and Settings\admin\" is given, how can I use the function split to separate this string and convert into an array. "C:\my fodler\hello" "C:\Documents and Settings\admin\" I have try with Chr$(22) which is the space btwn double quotation, but seemslike it can't find the space btwn. Also I have to be aware of those space for path"My Folder". Probably easy for others. Thanks Shin
-
when you have string "C:\my fodler\hello" "C:\Documents and Settings\admin\" is given, how can I use the function split to separate this string and convert into an array. "C:\my fodler\hello" "C:\Documents and Settings\admin\" I have try with Chr$(22) which is the space btwn double quotation, but seemslike it can't find the space btwn. Also I have to be aware of those space for path"My Folder". Probably easy for others. Thanks Shin
32 is the space character, not 22. The problem your going to have is that splitting on the space will also split on any spaces in the path names. Your string "C:\my fodler\hello" "C:\Documents and Settings\admin\", I'm assuming your including the quotes in the string!, will split liek this:
"C:\\my folder\\hello" "C:\\Documents and Settings
You will have to supply your own function to parse this string. Assuming your including the quotes in the string as above, you can split the string on the " character instead. Then look through the resulting array and remove the blank array items. This should give you the paths your looking for. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
when you have string "C:\my fodler\hello" "C:\Documents and Settings\admin\" is given, how can I use the function split to separate this string and convert into an array. "C:\my fodler\hello" "C:\Documents and Settings\admin\" I have try with Chr$(22) which is the space btwn double quotation, but seemslike it can't find the space btwn. Also I have to be aware of those space for path"My Folder". Probably easy for others. Thanks Shin
-
char [] charArray = string.split("\"") should do the trick you should end up with 3 parts 1 = " 2 = the dir path 3 = "
Nope. Using the original string he put in his first post and splitting on a backslash, he'd end up with
str = """C:\my fodler\hello"" ""C:\Documents and Settings\admin\"""
Dim charArray() = str.Split("\")0 = "C:
1 = my fodler
2 = hello" "C:
3 = Documents and Settings
4 = admin
5 = "RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
when you have string "C:\my fodler\hello" "C:\Documents and Settings\admin\" is given, how can I use the function split to separate this string and convert into an array. "C:\my fodler\hello" "C:\Documents and Settings\admin\" I have try with Chr$(22) which is the space btwn double quotation, but seemslike it can't find the space btwn. Also I have to be aware of those space for path"My Folder". Probably easy for others. Thanks Shin
You might want to try either of these methods: 1. Using Regular Expressions
Dim s As Regex = New Regex("\""([^\""]*)\""(?:\s)*") Dim match As Match = s.Match(w) ' where w is the string mentioned While (match.Success) ' match.Groups(1).Value will contain the string match = match.NextMatch() End While
2. Since filenames can't contain strings, you can replace " " sequence with a single character, trim the quotation marks at the beginning and end of the string, and use the Split function, as follows (assume w is the string that holds the folder names):Const quotchar As String = """" w = w.Trim(quotchar) ' remove quotes from start and end w = w.Replace(""" """, quotchar) ' replace " " with " Dim stringarray As String() = w.Split(quotchar) ' Now just invoke split and save to array
Hope this helps. :)