Remove only one newline from the end of string in vb.net -


मेरे पास नीचे की तरह एक स्ट्रिंग है

  test1 test2 test3 newline newline newline   

यहां मैं पिछली न्यूलाइन को निकालने के लिए केवल s = s.TrimEnd (ControlChars.Cr, ControlChars.Lf) का उपयोग कर रहा हूं, लेकिन यह सभी तीनों न्यूलाइन को निकाल रहा है।

मैं स्ट्रिंग से केवल एक ही अंतिम पंक्ति को निकालना चाहता हूं

पहले से धन्यवाद ...

आप इस तरह की कोशिश कर सकते हैं:

  यदि (s.EndsWith (Environment.NewLine)) {s = s.Remove (s.LastIndexOf (Environment.NewLine)) }    

Comments

Popular posts from this blog

c++ - why does this code produce a runtime error? -

java - Can Find the error -

maximum size of array in c -