Advertisement
brewersfan1976

replace_first_digit_reg_exp.rb

Jun 1st, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.38 KB | None | 0 0
  1. def replaceFirstDigitRegExp(input)
  2.     x = 0
  3.     string = ""
  4.     change = false
  5.     while (x < input.length)
  6.           if input[x] >= '0' and input[x] <= '9' and change == false then
  7.              string[x] = "#"
  8.              change = true
  9.           else
  10.              string[x] = input[x]
  11.           end
  12.              
  13.          x = x + 1
  14.     end
  15.        
  16.     return string
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement