Hello,

I'm stuck in below code snippet, looking to have a output as string without 
any digits.
Input : "H1e5ll0o"
Output: "Hello"

I tried with *output := strings.Replace(str, "1", "", -1)*, but it can 
replace only single digit at a time 

I'm looking for suggestions for below code snippet , tried to implement a 
logic where string converted to rune and rune provided 
as a input to IsDigit(), if it is digit it should replace the digit with "" 
and print the string , i'm not sure what mistake am i doing in providing 
parameter 
and printing output?

var output string

var r rune
for _, r = range input {
break 
}

if unicode.IsDigit(rune(r)) {
output = strings.Replace(input, "", "", -1)
fmt.Println(output)
}else{
fmt.Println(input)
}



On Saturday, 15 January 2011 at 01:31:08 UTC+5:30 Russ Cox wrote:

> There is also strings.Map.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/20e20834-0e60-45cf-8952-c7567fcfe66an%40googlegroups.com.

Reply via email to