find the position of character in a substring

potato

How can I find the first position of a character in a substring. Not in the string overall, but the first after a specified character position.

Example:

var str = "This is a test string"
//find the position of first "i" after "is"

let position = str.firstPositionOfIAfterPosition(5) // returns 18

I know I can find the overall first position with code below. How can I extend this to start looking only after a specified character position?

   let position = str.rangeOfString("i").startIndex
matt
var s = "This is a test string"
var targetRange = s.characters.indices
targetRange.startIndex = targetRange.startIndex.advancedBy(6) // skip past
let r = s.rangeOfString("i", options: [], range: targetRange, locale: nil)
// 18..<19

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Find position of a substring in a string(not indexOf)

From Dev

Find substring position into string with Javascript

From Dev

R: Substring after finding a character position?

From Dev

How to extract substring based on position of a character in JavaScript?

From Dev

R: Substring after finding a character position?

From Dev

How to find the the word position (not character position) in a string

From Dev

Java: Find a certain character and get substring

From Dev

find the largest substring that contains all of occurrence of a character

From Dev

Find substring with start and end position in mysql

From Dev

Python using a regex to find start position of a substring

From Dev

bash - find string index position of substring

From Dev

Find substring with start and end position in mysql

From Dev

How do I find the position of substring in PowerShell after position x?

From Dev

How to find the character in nth position in a string

From Dev

Find a character position in a string C++

From Dev

find and replace in eclipse "go to nth character position"

From Dev

Find the position of the last english character in a stream

From Dev

Find a character position in a string C++

From Dev

how to find the position of a character that sql had selected it

From Dev

find and replace in eclipse "go to nth character position"

From Dev

Find files with specific character in second position in name

From Dev

How to find the byte position from a string in a string, not the character position?

From Dev

Find and print the indexes of a substring in string that starts and ends with a specific character in python

From Dev

How to find position of substring column in a another column using Pyspark?

From Dev

How to find a substring position and length from a txt file

From Dev

SQL SERVER, use patIndex to find position of a character to the left of another character position

From Dev

Extract substring in R from string with fixed start position and end point as a character found

From Dev

How do I match a substring in either the first position or in the middle but with a specific character in front of it with a regular expression?

From Dev

Extract substring in R from string with fixed start position and end point as a character found

Related Related

  1. 1

    Find position of a substring in a string(not indexOf)

  2. 2

    Find substring position into string with Javascript

  3. 3

    R: Substring after finding a character position?

  4. 4

    How to extract substring based on position of a character in JavaScript?

  5. 5

    R: Substring after finding a character position?

  6. 6

    How to find the the word position (not character position) in a string

  7. 7

    Java: Find a certain character and get substring

  8. 8

    find the largest substring that contains all of occurrence of a character

  9. 9

    Find substring with start and end position in mysql

  10. 10

    Python using a regex to find start position of a substring

  11. 11

    bash - find string index position of substring

  12. 12

    Find substring with start and end position in mysql

  13. 13

    How do I find the position of substring in PowerShell after position x?

  14. 14

    How to find the character in nth position in a string

  15. 15

    Find a character position in a string C++

  16. 16

    find and replace in eclipse "go to nth character position"

  17. 17

    Find the position of the last english character in a stream

  18. 18

    Find a character position in a string C++

  19. 19

    how to find the position of a character that sql had selected it

  20. 20

    find and replace in eclipse "go to nth character position"

  21. 21

    Find files with specific character in second position in name

  22. 22

    How to find the byte position from a string in a string, not the character position?

  23. 23

    Find and print the indexes of a substring in string that starts and ends with a specific character in python

  24. 24

    How to find position of substring column in a another column using Pyspark?

  25. 25

    How to find a substring position and length from a txt file

  26. 26

    SQL SERVER, use patIndex to find position of a character to the left of another character position

  27. 27

    Extract substring in R from string with fixed start position and end point as a character found

  28. 28

    How do I match a substring in either the first position or in the middle but with a specific character in front of it with a regular expression?

  29. 29

    Extract substring in R from string with fixed start position and end point as a character found

HotTag

Archive