Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
I ahve a string "10.25 POLYSTER FILM 10.25x0 11gsm 12mic" I have to remove string that has "x"  in the middle of it. Either side of this character there are numbers, and has decimal also there i have to remove it


What I have tried:

For g = 1 To VS_Paper_Grid_1.Rows - 1
lLastSlash = InStr(1, VS_Paper_Grid_1.TextMatrix(g, 0), "x")
If lLastSlash > 0 Then
Paper_Name = Left$(VS_Paper_Grid_1.TextMatrix(g, 0), 2)
Paper_Name = Right$(VS_Paper_Grid_1.TextMatrix(g, 0), 2)

VS_Paper_Grid_1.TextMatrix(g, 0) = Paper_Name
lLastSlash1 = InStr(1, Paper_Name, "/")
Paper_Name = Left$(lLastSlash1, lLastSlash - 1)
End If
Next
Posted
Updated 18-Feb-16 1:58am

1 solution

Your code doesn't make any sense.... what you could do:

Use the Split[^] function to split your string into an array of substrings split by the blank spaces, then re-combine these omitting the string with the 'x' in.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900