1

I want 10576.53012.46344.35174 from string

"CompositionClassification|CC000003|01|10576.53012.46344.35174"

I have index of last occurrence of |, how will i get complete 10576.53012.46344.35174 sub-string from last |

Not familiar with TCL, Suggest solution on this :)

2
  • You want the string range command Commented Jun 21, 2017 at 9:57
  • Thanks, Got the string using String range Commented Jun 21, 2017 at 10:31

1 Answer 1

1

If you know the index of the first character you want, and you want from there to the end, you use:

set theSubstring [string range $theString $idx end]

However in this case I'd use split and lindex, since it looks like a simple delimited list:

set theSubstring [lindex [split $theString "|"] end]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.