Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def insertDashes(inputString)
- array_length = inputString.length
- x = 0
- string = ""
- while (x < array_length)
- if x == array_length - 1 then
- string = string + inputString[x]
- break
- end
- if inputString[x] != ' ' and inputString[x + 1] != ' ' then
- string = string + inputString[x] + '-'
- else
- string = string + inputString[x]
- end
- x = x + 1
- end
- return string
- end
Advertisement
Add Comment
Please, Sign In to add comment