Hi, Here I have added the link for my exact concern. Please consider from byte conversion to string only. Here getting as expected but while reading from another process not working with strings package. https://play.golang.org/p/7YqfuLWQHtT
On Wed, Aug 28, 2019 at 12:04 AM Martin Schnabel <m...@mb0.org> wrote: > You can use the go playground to share an example. Like this: > > https://play.golang.org/p/8RJXT-e91T5 > > As you can see in that example both functions work as expected. > We can only guess what the problem might be without a concrete > example. > > One guess would be that your input has not the newline byte, but > instead the escaped sequence '\' and 'n'? Then you would need > to use the escape sequence for the slash in the search string: > > https://play.golang.org/p/O-c76dM_E5B > > > On 27.08.19 20:06, Durga Someswararao G wrote: > > Hi, > > > > Can anyone help me in this case. > > > > I was reading byte data(array of bytes) from another process and > > converted that data to string. Now I am trying to replace escape > > sequences \n with strings.Replace function but golang not detecting it. > > > > Even I tried with bytes.Replace function but no use. > > > > Also observed even strings.Contains function also not detecting \n. > > > > Eg: > > > > strings.Replace("String1\nString2", "\n", "golang",-1 ) > > > > Please help to solve this Issue. Can anyone share any issues with > > strings package while after converting bytes to string. > > -- > 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/80a19b01-6843-0b44-1ace-e7b73a0e62c9%40mb0.org > . > -- 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/CA%2Ba9DGpTmLesaMjWPTU2qyJ5mSGe%3D%3DSEA8i%3D78uEy7db7GebHg%40mail.gmail.com.