ruby - Find the position of a marker in a string relative to another -


i've got 2 strings, 1 sanitized , 1 marker. marker fixed string , chosen arbitrary, inserted string other code.

 sanitized = "100 biz other stuff"  marked = " 100    biz marker other stuff" 

now match surroundings of marker sanitized string.

 # _ empty, string expanded visual  sanitized =  "100 ___biz_______ other stuff"  marked =    " 100    biz marker other stuff" 

and index of marker in sanitized string.

 sanitized =  "100 ___biz_marker other stuff"                           ^  marked =    " 100    biz marker other stuff" 

which 7.

i'm not clear on you're asking either. sounds need know how find location of string inside of string.

virtual = "100 biz marker other stuff" virtual.index 'marker' # => 8 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -