Answers for "python code display first letter and last letter of word string indexing"

4

get first x characters of string python

characters = 4
string = "This is a string"
print(string[:characters])
#output: 'This'
Posted by: Guest on June-24-2021
0

Get the First and Last Word from a String or Sentence

DECLARE @Sentence    VARCHAR(MAX) = 'The quick brown fox jumps over the lazy dog'

SELECT SUBSTRING(@Sentence, 1, CHARINDEX(' ', @Sentence) - 1) AS [First Word],
       REVERSE(SUBSTRING(REVERSE(@Sentence), 1,                CHARINDEX(' ', REVERSE(@Sentence)) - 1)) AS [Last Word]
Posted by: Guest on April-30-2021

Code answers related to "python code display first letter and last letter of word string indexing"

Python Answers by Framework

Browse Popular Code Answers by Language