Every line of 'get first letter of string python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
114 @register.filter 115 def first_letters(string): 116 return ''.join(s[0].upper() for s in string.split(" "))
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
42 def firstUniqChar(self, s): 43 """ 44 :type s: str 45 :rtype: int 46 """ 47 alphabet = 'abcdefghijklmnopqrstyvwxyz' 48 index = len(s) 49 for c in alphabet: 50 if c in s: 51 l = s.find(c) 52 r = s.rfind(c) 53 else: 54 continue 55 if l == r and l < index: 56 index = l 57 if index == len(s): 58 return -1 59 return index