Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

line contains command

Status
Not open for further replies.

fishejk05

Programmer
Joined
Jul 22, 2009
Messages
2
Location
US
Hi all. I am extremely new to Tcl. I am curious if there is a line contains command, similar to the C# string.Contains().

Any help would be greatly appreciated!

Thank you!
 
Hi

No. The closest is to use [tt]string first[/tt] :
Code:
[b]set[/b] which [green][i]"Hello World"[/i][/green]
[b]set[/b] what [green][i]"ll"[/i][/green]

[b]if[/b] [teal]{[/teal][teal][[/teal][b]string[/b] first [navy]$what[/navy] [navy]$which[/navy][teal]]!=-[/teal][purple]1[/purple][teal]}[/teal] [teal]{[/teal]
  [b]puts[/b] [green][i]"The string '$which' contains '$what'"[/i][/green]
[teal]}[/teal] [b]else[/b] [teal]{[/teal]
  [b]puts[/b] [green][i]"The string '$which' not contains '$what'"[/i][/green]
[teal]}[/teal]
Next time when referring to another language's feature, please describe it or provide a link to its description.


Feherke.
 
all right. thank you very much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top