如何使用“/”键找到序列的最后一位数字。 asp.net vb.net [英] How do I find the last digit of the sequence with "/" asp.net vb.net

查看:117
本文介绍了如何使用“/”键找到序列的最后一位数字。 asp.net vb.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,如果你帮助我,我将非常感激。



在下图中我们有一个字符串,包含批处理中的所有内容由moraru vladut预订是一个字符串。其中我想只删除红色圈出的数量。我不知道在拍摄之后,可以找到/之后进行拆分或者其他吗?



我圈出之前的节目的最后一个/是差异化的,但是可以包含两个/



http://postimg.org / image / onmt8es2l / full / [ ^ ]



非常感谢!

解决方案

下面代码应该有效:

  Dim  temp  As   String  =  批次235/689/45 pct已预订 
temp = temp.Substring(temp.LastIndexOf( / C)+ 1
Dim lastValue As String = temp.Split( C )( 0 )。ToString()


  Dim  str  As   String  =   235689/45 
Dim 数字作为 整数 = 整数 .Parse(str.Split ( / C)( 1 ).ToString())



希望你想要这个:)



-KR


我在这里有解决方案:



 昏暗 regExMatch2  As  System.Text.RegularExpressi ons.Match 
regExMatch = System.Text.RegularExpressions.Regex.Match(CheckIfBooked, 批量(。+ )/ \\\ + pcs,System.Text.RegularExpressions.RegexOptions.IgnoreCase)
regExMatch2 = System.Text.RegularExpressions.Regex.Match(CheckIfBooked, Batch(。+)/(\d +)pcs,System.Text.RegularExpressions.RegexOptions.IgnoreCase)
如果 regExMatch.Success 那么
batch = regExMatch.Groups( 1 )。值
结束 如果


Hi, I have a problem and I would be very grateful if you help me.

In the picture below we have a string, containing everything from "batch" to "booked out by moraru vladut" is a String. Of this I want to remove only the amount circled in red. I do not know after take, to make split after "/" can be found or otherwise?

The last "/" of the show before I circled differentiated, but can contain two "/"

http://postimg.org/image/onmt8es2l/full/[^]

Thanks a lot!

解决方案

Below code should work:

Dim temp As String = "batch 235/689/45 pct booked out"
temp = temp.Substring(temp.LastIndexOf("/"C) + 1)
Dim lastValue As String = temp.Split(" "C)(0).ToString()


Dim str As String = "235689/45"
Dim digit As Integer = Integer.Parse(str.Split("/"C)(1).ToString())


Hope you wanted this :)

-KR


I have Solution here:

Dim regExMatch2 As System.Text.RegularExpressions.Match
                           regExMatch = System.Text.RegularExpressions.Regex.Match(CheckIfBooked, "Batch (.+)/\d+ pcs", System.Text.RegularExpressions.RegexOptions.IgnoreCase)
                           regExMatch2 = System.Text.RegularExpressions.Regex.Match(CheckIfBooked, "Batch (.+)/(\d+) pcs", System.Text.RegularExpressions.RegexOptions.IgnoreCase)
                           If regExMatch.Success Then
                               batch = regExMatch.Groups(1).Value
                           End If


这篇关于如何使用“/”键找到序列的最后一位数字。 asp.net vb.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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