![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Re: Extracting the last char from the string Hi, I am stuck and need help. I have a string str which can have variuos values ex. str="C7,CR101,CR102," str="RF1003" str="FE12,FE36," I need to have str without the comma. I have the code that I have written and it does not work. Any ideas as to what is missing. My Code ------------ findComma = Right(str,1) start = len(str) -1 if findComma = "," then mystring=Replace(str, findComma, "" , start ,1) end if |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Extracting the last char from the string On Nov 18, 12:09*pm, sa <agarwasa2...@xxxxxx> wrote: Quote: > Hi, > > I am stuck and need help. I have a string str which can have variuos > values ex. > > str="C7,CR101,CR102," > str="RF1003" > str="FE12,FE36," > > I need to have str without the comma. I have the code that I have > written and it does not work. *Any ideas as to what is missing. > > My Code > ------------ > findComma = Right(str,1) > start = len(str) -1 > if findComma = "," then > * * * * mystring=Replace(str, findComma, "" , start ,1) > end if if Right(str,1) = "," then str = left(str, len(str) - 1) Tom Lavedas *********** http://there.is.no.more/tglbatch/ |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Extracting the last char from the string On Nov 18, 10:44*am, Tom Lavedas <tglba...@xxxxxx> wrote: Quote: > On Nov 18, 12:09*pm, sa <agarwasa2...@xxxxxx> wrote: > > > > > Quote: > > Hi, Quote: > > I am stuck and need help. I have a string str which can have variuos > > values ex. Quote: > > str="C7,CR101,CR102," > > str="RF1003" > > str="FE12,FE36," Quote: > > I need to have str without the comma. I have the code that I have > > written and it does not work. *Any ideas as to what is missing. Quote: > > My Code > > ------------ > > findComma = Right(str,1) > > start = len(str) -1 > > if findComma = "," then > > * * * * mystring=Replace(str, findComma, "" , start ,1) > > end if > How about ... > > * if Right(str,1) = "," then str = left(str, len(str) - 1) > > Tom Lavedas > ***********http://there.is.no.more/tglbatch/- Hide quoted text - > > - Show quoted text - |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Extracting the last char from the string sa wrote: Quote: > > I am stuck and need help. I have a string str which can have variuos > values ex. > > str="C7,CR101,CR102," > str="RF1003" > str="FE12,FE36," > > I need to have str without the comma. I have the code that I have > written and it does not work. Any ideas as to what is missing. .Pattern = ",$" ' match comma at end of string For Each str In Array("C7,CR101,CR102,", "RF1003", "FE12,FE36,") WScript.Echo .Replace(str, "") Next End With -- Introduction to Regular Expressions (Scripting) <http://msdn.microsoft.com/en-ca/library/6wzad2b2(VS.85).aspx> -- Steve We do not see things as they are, we see things as we are. -Talmudic Saying |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Get single char from string by position ? | VB Script | |||
| double char? | General Discussion | |||
| Extracting drive, path, filebasename WITH string functions and NOT system function ??? | VB Script | |||
| Re: how to count number of certain char within string | PowerShell | |||
| Problem Calling String(char[] value) constructor | PowerShell | |||