Ruby ersetzen Sie das erste Zeichen in der Zeichenfolge
To replace the first two characters of a string with 'Hello':
x = "This is a test"
puts x.sub(/^../, 'Hello')
Viper
To replace the first two characters of a string with 'Hello':
x = "This is a test"
puts x.sub(/^../, 'Hello')