Dan Diebolt
3/13/2008 10:00:00 PM
[Note: parts of this message were removed to make it a legal post.]
Don't use a regexp. It isn't clear what you want to happen if there isn't a middle character if the string has a odd integer for its length. Try using some type of substring approach such as this:
str = "xxx"
str[0..str.length/2-1] +
str[str.length/2,1] * 4 +
str[str.length/2+1..str.length]
=> "xxxxxx"