stringObject.substring(start,stop)

用于提取字符串中 介于两个指定下标之间的字符。


start 必需。一个非负的整数

stop 可选。一个非负的整数

转载于:https://www.cnblogs.com/circlebreak/p/5404583.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
private void timer1_Tick(object sender, EventArgs e) { if (totalTime >= 20000)// 最多读20秒 { timer1.Stop(); ShutCamera(); textBox1.Text = "未识别到条形码"; return; } Bitmap barcodeImage; barcodeImage = videoSourcePlayer1.GetCurrentVideoFrame();//拍摄 if (barcodeImage != null) { // 识读条形码 BarcodeReader reader = new BarcodeReader(); reader.Options.CharacterSet = "UTF-8"; reader.Options.PossibleFormats = new List<BarcodeFormat>() { BarcodeFormat.CODE_128 }; Result resultBarcode = reader.Decode(barcodeImage); if (resultBarcode != null) { textBox1.Text = " "; textBox1.AppendText(resultBarcode.Text); timer1.Stop(); ShutCamera(); return; } } totalTime += delaytime; textBox1.Text = totalTime.ToString() + " ms"; //if (totalTime == 3000) // picture.Save("测试图片.bmp"); } private void button4_Click(object sender, EventArgs e) { string searchNum = textBox1.Text.Trim(); searchNum = searchNum.Substring(0, 8); // 只取前8位 string folderPath = textBox2.Text.Trim(); foreach (string filePath in Directory.GetFiles(folderPath, "*.pdf")) { string fileName = Path.GetFileNameWithoutExtension(filePath); if (fileName.Length >= 8) { string firstEightDigits = fileName.Substring(0, 8); if (firstEightDigits == searchNum) { Process.Start(filePath); return; // 打开第一个匹配的pdf文件后退出循环 } } } MessageBox.Show("未找到匹配的pdf文件。"); } 修改为扫描出条形码在文本框中只显示8位并打开第一个匹配的pdf文件后退出循环
最新发布
06-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值