@@ -0,0 +1,3071 @@
+#File: moduleCase2.py%0A#Description:%0A#This is a module containing functions to change case of a string%0A#%0A#Date: 16-06-2014 monday%0A#Author: Yusuf Shakeel%0A#%0A#youtube.com/yusufshakeel%0A#plus.google.com/+YusufShakeel%0A#https://github.com/yusufshakeel/Python-Project%0A#%0A#The MIT License (MIT)%0A#%0A#Copyright (c) 2014 Yusuf Shakeel%0A#%0A#Permission is hereby granted, free of charge, to any person obtaining a copy of%0A#this software and associated documentation files (the %22Software%22), to deal in%0A#the Software without restriction, including without limitation the rights to%0A#use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of%0A#the Software, and to permit persons to whom the Software is furnished to do so,%0A#subject to the following conditions:%0A#%0A#The above copyright notice and this permission notice shall be included in all%0A#copies or substantial portions of the Software.%0A#%0A#THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR%0A#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS%0A#FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR%0A#COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER%0A#IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN%0A#CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.%0A%0A%0A#function definition%0A#check alphabet%0Adef isAlpha(ch):%0A    if ('a'%3C= ch %3C= 'z') or ('A' %3C= ch %3C= 'Z'):%0A        return True%0A    return False%0A%0A#check lower case%0Adef isLower(ch):%0A    if 'a'%3C= ch %3C='z':%0A        return True%0A    return False%0A%0A#check upper case%0Adef isUpper(ch):%0A    if 'A' %3C= ch %3C= 'Z':%0A        return True%0A    return False%0A%0A#convert to lower case%0A#param ch - upper case character%0Adef toLower(ch):%0A    i = ord(ch)         #this will return the ascii value%0A    return chr(i+32)    #return lowercase character%0A%0A#convert to upper case%0A#param ch - lower case character%0Adef toUpper(ch):%0A    i = ord(ch)         #this will return the ascii value%0A    return chr(i-32)    #return uppercase character%0A%0A#convert to lower case - string%0A#param s - string s to convert to lower case%0A#note! string are immutable so we cannot change them directly%0Adef toLowerCase(s):%0A    slen = len(s)               #length of the string s%0A    lowstr = ''                 #lower case string that will be returned%0A    for index in range(slen):   #loop from index 0 to slen-1%0A        if isAlpha(s%5Bindex%5D) and isUpper(s%5Bindex%5D):%0A            lowstr += toLower(s%5Bindex%5D)%0A        else:%0A            lowstr += s%5Bindex%5D%0A    return lowstr%0A%0A#convert to upper case - string%0A#param s - string s to convert to upper case%0A#note! string are immutable so we cannot change them directly%0Adef toUpperCase(s):%0A    slen = len(s)               #length of the string s%0A    upstr = ''                  #upper case string that will be returned%0A    for index in range(slen):   #loop from index 0 to slen-1%0A        if isAlpha(s%5Bindex%5D) and isLower(s%5Bindex%5D):%0A            upstr += toUpper(s%5Bindex%5D)%0A        else:%0A            upstr += s%5Bindex%5D%0A    return upstr%0A

convert case of string - lower and upper case