I have a string
CSV
which has values "1,2"
.
I need to convert it to a Char
CSV
to be passed to a stored procedure. Which looks like. "'1','2'"
.
I tried something like following. But its not working.
String.Join(",", equipmentName.ToArray<char>())
Try this.
var result = string.Join(",", "1,2".Split(',').Select(x => string.Format("'{0}'", x)));
Output
'1','2'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.