博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
数组根据index拆分和查询下标
阅读量:7006 次
发布时间:2019-06-27

本文共 818 字,大约阅读时间需要 2 分钟。

private class ArrayTool
{ ///
查询值在数组中的下标 ///
数组 ///
查询的参数 ///
下标
public static int ArrayQueryIndex(T[] array, T param) { for (int i = 0; i < array.Length; i++) if (array[i].Equals(param)) return i; return 0; } ///
根据下标拆分出新数组 ///
原数组 ///
结束下标 ///
开始下标 ///
新数组
public static T[] NewArrayByIndex(T[] array, int EndIndex, int StartIndex) { T[] result = new T[EndIndex - StartIndex + 1]; for (int i = 0; i <= EndIndex - StartIndex; i++) result[i] = array[i + StartIndex]; return result; } }

 

转载于:https://www.cnblogs.com/handsCool/p/4638338.html

你可能感兴趣的文章
学号20172328《程序设计与数据结构》第九周学习总结
查看>>
js鼠标滑轮滚动事件绑定(兼容主流浏览器)
查看>>
//获取本地IP地址和对端IP地址
查看>>
网页在线进行标准验证
查看>>
滑动CheckBox样式
查看>>
避免多次提交
查看>>
Could not parse mapping document from input stream
查看>>
Android网络通信框架Volley总结
查看>>
最全的select加锁分析(Mysql)
查看>>
python multiprocessing 多进程
查看>>
Django 学习笔记之二 基本命令
查看>>
机器学习入门之四:机器学习的方法-神经网络(转载)
查看>>
该怎样用几何画板绘制正五边形呢
查看>>
【转】高扩展性网站的50条原则
查看>>
silverlight中的textblock和textbox 使用之tips
查看>>
Secure Sockets Layer(安全套接层)
查看>>
微信小程序登录对接Django后端实现JWT方式验证登录
查看>>
七月馒头
查看>>
2个按钮控制的左右图片滚动特效代码
查看>>
最大流最小割定理
查看>>