I need to check if last element of list is uppercaseFor example
That's what I tried
checkLast :: [a] -> BoolcheckLast  = FalsecheckLast [x] = if isUpper x then True else FalsecheckLast (x:xs) = if isUpper last then True else False
How can I separate firstname and surname from a string like this:
Pietro DE GIOVANNI
Pietro being the firstname and
DE GIOVANNI the surname)
I used to do it with an
explode() on the spaces, but obviously it doesn't work on a person like that.
Thanks in advance.
My program is supposed to take an input in form of a string and split into to strings, one with all the lower case letters, underscores and dots. The other one with all the upper cases, the pipes and the spaces. I am not supposed to use (for function)
def split_rec (letters): uppers = "" lowers = "" if letters.isupper() or letters == "|" or letters.isspace(): uppers += letters + split_rec (letters[1:]) elif letters.islower() or letters == "_" or letters == ".": lowers += letters + split_rec (letters[1:]) elif not letters: return lowers, uppers
Can you please tell me more about the error I'm getting?
if letters.isupper() or letters == "|" or letters.isspace(): IndexError: string index out of range
I'm converting a bunch of (Progress) programs for use on linux (previously used on Windows) and I'm looking for a way to grep for program names with both uppercase and lowercase letters, such as "skip_xref.I" or "NO_dt2.i". How can I achieve this?
How do I take a string and convert it to lower or upper case in Ruby?