string.split has some invalid arguments
oledbex.Message.Split("'")(1).Replace("$", "") string scale = colNamePrecMap[dcolItem].ToString().Split(",")(1); Can anyone help me with this Thanks i advance
Risposte
the given code is syntactically incorrect.
Please note that the Split(Char[]) returns string array.
here is an example to demonstrate it.
string someStr = "balaji baskar"; string[] strArrys = someStr.Split(' '); foreach (string arr in strArrys) { MessageBox.Show(arr); //There are two strings //Prints "Balaji" first //Prints "Baskar" second //Now you can use Replace function arr.Replace('b','B'); }
Balaji Baskar [Please mark the post as answer if it answers your question]- Contrassegnato come rispostaYiChun ChenMSFT, Moderatorvenerdì 6 novembre 2009 10.36
- Split takes characters, "'" is a string. '\'' is a character. You have to escape the apostrophe so it doesn't think it's the end of the character.
You don't have to with the comma though, you can just use ','- Contrassegnato come rispostaYiChun ChenMSFT, Moderatorvenerdì 6 novembre 2009 10.37
- Hi Sam581,
Thank you for your post.
To apply String.Split Method, we should check the following syntax:
Split(array<Char>[]()[], Int32)
Split(array<Char>[]()[], StringSplitOptions)
Split(array<String>[]()[], StringSplitOptions)
Split(array<Char>[]()[], Int32, StringSplitOptions)
Split(array<String>[]()[], Int32, StringSplitOptions)
For more information, please check: http://msdn.microsoft.com/en-us/library/system.string.split.aspx
Hope this helps. If you have any concern, please feel free to let me know.
Best regards,
Yichun Chen
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Contrassegnato come rispostaYiChun ChenMSFT, Moderatorlunedì 9 novembre 2009 2.22
Tutte le risposte
the given code is syntactically incorrect.
Please note that the Split(Char[]) returns string array.
here is an example to demonstrate it.
string someStr = "balaji baskar"; string[] strArrys = someStr.Split(' '); foreach (string arr in strArrys) { MessageBox.Show(arr); //There are two strings //Prints "Balaji" first //Prints "Baskar" second //Now you can use Replace function arr.Replace('b','B'); }
Balaji Baskar [Please mark the post as answer if it answers your question]- Contrassegnato come rispostaYiChun ChenMSFT, Moderatorvenerdì 6 novembre 2009 10.36
- Split takes characters, "'" is a string. '\'' is a character. You have to escape the apostrophe so it doesn't think it's the end of the character.
You don't have to with the comma though, you can just use ','- Contrassegnato come rispostaYiChun ChenMSFT, Moderatorvenerdì 6 novembre 2009 10.37
- Hi Sam581,
Thank you for your post.
To apply String.Split Method, we should check the following syntax:
Split(array<Char>[]()[], Int32)
Split(array<Char>[]()[], StringSplitOptions)
Split(array<String>[]()[], StringSplitOptions)
Split(array<Char>[]()[], Int32, StringSplitOptions)
Split(array<String>[]()[], Int32, StringSplitOptions)
For more information, please check: http://msdn.microsoft.com/en-us/library/system.string.split.aspx
Hope this helps. If you have any concern, please feel free to let me know.
Best regards,
Yichun Chen
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Contrassegnato come rispostaYiChun ChenMSFT, Moderatorlunedì 9 novembre 2009 2.22

