Conversion of string to upper case without inbuilt methods

前端 未结 7 1835
轻奢々
轻奢々 2021-01-29 08:28

I am trying to perform conversion from a lowercase to uppercase on a string without using any inbuilt functions (other than ord() and char()). Following the logic presented on a

7条回答
  •  误落风尘
    2021-01-29 08:38

    The below-simplified code help to convert Lower-case alphabets to Upper-case alphabets using a simple calculation

    code :

    def toUppercase(string):
        convertedCharacter = ''
        for i in string: 
             convertCharacter += chr( ( (ord(i)) -32) ) 
        return convertCharacter
    

提交回复
热议问题