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

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -