Search the Community
Showing results for tags 'comma'.
-
Hi All, I'd like to replace 'COMMA' with ',' for example: $myString = "COMMA" StringRegExpReplace($myString, 'COMMA', ',') Now I've tried escaping the ',' in various ways unsuccessfully, such as: '[,]' "[,]" '\,' [,] seems to work in the pattern, I just can't figure out how to use it in the replace, and it seems everyone online is only interested in removing/replacing commas lol. I also tried creating and using a variable as the replacement but also didn't work: $myComma = "," $myString = "COMMA" StringRegExpReplace($myString, 'COMMA', $myComma) I'm sure it's super simple if someone could point me in the right direction - thanks.
-
Dim $oneDarray $oneDarray=StringSplit($Rawfile, @CRLF, 1) $columnsCounter = stringsplit($oneDarray[2],",") GUICtrlSetData ( $Output,"*Group columns Detected from csv:"& $columnsCounter[0] &@CRLF, @CR) ConsoleWrite("*Group columns Detected from csv:"& $columnsCounter[0] &@CRLF) Dim $twoDarray[$oneDarray[0] + 1][$columnsCounter[0] + 1] For $x = 1 to ($oneDarray[0]) $oneRow = stringsplit($oneDarray[$x],",") For $y = 1 to ($oneRow[0]) $twoDarray[$x][$y] = $oneRow[$y] Next Next Log Output Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $twoDarray[$x][$y] = $oneRow[$y] ^ ERROR So I have a csv file that I'm breaking up to do string parsing for information from and I've run into a problem I'm not sure how to solve. In the code shown above I am creating the master 2d array that holds all the values from the csv. The problem the code runs into starts on this line: $oneRow = stringsplit($oneDarray[$x],",") It worked great until I ran into a csv file that had commas in a txt field that were not related to the csv format.. example: "this is some text, and some more text", filedir, ipaddress, hostname,mmmbeer as CSV format this is 5 fields, however the stringsplit counts the comma in the text and identifies this as 6 fields. Any ideas how I can somehow not include the comma in quotes in stringsplit? Thanks, Bob
- 7 replies
-
- stringsplit
- comma
-
(and 2 more)
Tagged with: