在空格处分割字符串文本,并在任意数字上除数值 [英] Split the string text on space and divide the value on any number

查看:64
本文介绍了在空格处分割字符串文本,并在任意数字上除数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好...
我想知道,
我在(Windows窗体应用程序)的Richtextbox中有一个文本,我想在(&)字符上分割此文本并采用此值,并且想将该值除以数字(任意数字).我该怎么做,请帮助我.

Hello...
I want know,
I have a text in Richtextbox in (Windows form application) and I want split this text on (&)character and take this value and I want to divide this value by the number(any number).How I can doing this thing ,please help me.

推荐答案

尝试:
string s = myRichTextBox.Text;
string[] parts = s.Split('&');
int value = 0;
if (int.TryParse(parts[0], out value))
    {
    value /= 6;
    }


这篇关于在空格处分割字符串文本,并在任意数字上除数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆