indexOf(何文字目にあるか)
Python
py
s.find('a')
s.index('a')
右から探す場合
py
s.rfind('h')
Swift
swift
s.firstIndex(of: "c")
Index
型で位置は返してくれるが、数字でないので これでは「何文字目」は分からないか。
数字にするには、こう・・?
swift
s.distance(from: s.startIndex, to: s.firstIndex(of: "c")!)
Ruby
rb
s.index('c')
右から探す場合
py
str1.rindex('h')
C++
c
strstr(str, "abc")
strchr(str, 'a')
Visual Basic
vb
InStr(str, Chr(13))