zoukankan      html  css  js  c++  java
  • 第三节 7练习6 简单

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    
    namespace _7练习6
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                string s = tb_content.Text;
                //string[] str = s.Split('\r\n');方法1: 按钮\r\n进行split
                //MessageBox.Show("s=="+s);
                //string[] str = s.Split(new string("\r\n",)
                //string[] lines = tb_content.Lines; //取得所有列
                //记住Split分割多个字符的用户法啊啊啊啊啊啊
                string[] lines = s.Split(new string[]{"\r\n"},StringSplitOptions.RemoveEmptyEntries);
                
                
                string maxName = "";
                int maxScore = -1;
                foreach (string line in lines) 
                {
                    string[] strs = line.Split('=');
                    string name = strs[0];
                    string strScore = strs[1];
    
                    int score = Convert.ToInt32(strScore);
                    if (score > maxScore) {
                        maxName = name;
                        maxScore = score;
                    }
                }
                MessageBox.Show(string.Format("第一名是:{0},成绩:{1}", maxName, maxScore));
            }
        }
    }
    

      

  • 相关阅读:
    Hibernate之二级缓存
    Hibernate之HQL
    Hibernate 一对多自关联 多对多
    hibernate关联关系(一对多)
    Hibernate之主键生成策略
    Hibernate01
    struts的图片上传
    HashMap和HashTable本质性的区别
    集合03
    集合
  • 原文地址:https://www.cnblogs.com/xiangxiaodong/p/2370609.html
Copyright © 2011-2022 走看看