Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python get first letter of string

import re

def first_letter(s):
    m = re.search(r'[a-z]', s, re.I)
    if m is not None:
        return m.start()
    return -1

s = "##catgiraffeapluscompscI"
i = first_letter(s)
print(i)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #letter #string
ADD COMMENT
Topic
Name
3+9 =