using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string[] str = { "student","iphone","abs","ball","wc"};
SortStringArray(str,SortType.rise); for (int i = ; i < str.Length; i++)
{
Console.WriteLine(str[i]);
} Console.ReadKey();
} //按字母排序
static void SortStringArray(string [] array,SortType type)
{
string temp = null; //降序
if (type == SortType.drop)
{
for (int i = ; i < array.Length; i++)
{
for (int j = i; j < array.Length; j++)
{
if ((int)array[i][] < (int)array[j][])
{
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
}//升序
else if(type == SortType.rise)
{
for (int i = ; i < array.Length; i++)
{
for (int j = i; j < array.Length; j++)
{
if ((int)array[i][] > (int)array[j][])
{
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
} } public enum SortType
{
drop,
rise
} } }

冒泡算法对string数组排序O(∩_∩)O~

新人求关照,求大家多多指点

string字母排序,的更多相关文章

  1. [Android分享] 【转帖】Android ListView的A-Z字母排序和过滤搜索功能

      感谢eoe社区的分享   最近看关于Android实现ListView的功能问题,一直都是小伙伴们关心探讨的Android开发问题之一,今天看到有关ListView实现A-Z字母排序和过滤搜索功能 ...

  2. 联系人的侧边字母索引ListView 将手机通讯录姓名通过首字母排序。

      package com.lixu.letterlistview; import java.util.ArrayList; import java.util.List; import org.apa ...

  3. 获取手机通讯录放入PinnedSectionListView中,按名字首字母排序,并且实现拨打电话功能。

    package com.lixu.tongxunlu; import java.util.ArrayList; import com.lixu.tongxunlu.PinnedSectionListV ...

  4. Android 联系人字母排序(仿微信)

    现在很多APP只要涉及到联系人的界面,几乎都会采取字母排序以及导航的方式.作为程序猿,这种已经普及的需求还是需要学习的,于是小生开始了在网上默默的学习之路,网上学习的资料质量参差不齐,不过也有很不错的 ...

  5. HashMap加入数据后,会自动根据首字母排序

    1.Map<String, ArrayList<XX>> entityHashMap = new HashMap<>(); 然后增加一些数据,会发现根据String ...

  6. Android 实现ListView的A-Z字母排序和过滤搜索功能,实现汉字转成拼音

    转载:http://blog.csdn.net/xiaanming/article/details/12684155 转载请注明出处:http://blog.csdn.net/xiaanming/ar ...

  7. 对JSON格式的城市按照拼音首字母排序

    需求说明: App应用中最常见的一种操作就是对城市按照拼音首字母排序,以方便选择城市.而已有的json格式的城市数据是没有这种排序的. 已有的json格式的城市数据格式如下[简化之后]: 数据格式说明 ...

  8. 列表按照字母排序检索SideBar

    项目中要求列表按照ABCD这种字母排序检索的功能,看了大神写的,瞬间崇拜了,接下来借大家参考参考了 首先是自定义view sidebar /** * @author J *一个自定义view 实现a- ...

  9. Android 使用ListView的A-Z字母排序功能实现联系人模块

    在上一篇文章其中,主要学习了ListView的A-Z字母排序功能以及依据输入框的输入值改变来过滤搜索结果,假设输入框里面的值为空.更新为原来的列表,否则为过滤数据列表,包含汉字转成拼音的功能.假设你还 ...

随机推荐

  1. swift 弹窗

    直接拷贝使用即可 let alert = UIAlertController(title:nil,message:"输入不能为空",preferredStyle: .Alert) ...

  2. Android + eclipse +ADT安装完全教程

    最近几天没事做,网上看来看去突然就想弄个android来学学...  首先,是要下载android SDK,在http://developer.android.com/sdk/index.html这个 ...

  3. [Redux] Extracting Presentational Components -- TodoApp

    Finally, I just noticed that the to-do app component doesn't actually have to be a class. I can turn ...

  4. IT痴汉的工作现状25-技术之养成

    要想成为技术大牛,除了天赋以外,更与后天的刻苦努力分不开.伟仔我天生愚顿.工作多年后仍与大牛相差甚远,更加觉得技术的养成是一个异常困难的过程. 是我不用功吗?我不这样觉得.伟仔尽管是个懒人,但对于技术 ...

  5. 程序员的家!我终于拥有自己的blog了!!!

    经过多次提交诚恳的家园申请,终于得到了审核通过!今天就开始了我的.net成长之路!!!

  6. (转)window.location.search的用法

    location.search是从当前URL的?号开始的字符串如:http://www.51js.com/viewthread.php?tid=22720它的search就是?tid=22720 通过 ...

  7. Android入门2:从GridView控件使用到自定义Adapter

    在日常手机app的使用中,出现频率最高的便是ListView和GridView.ListView的例子是微信主界面,而GridView的例子则是支付宝的主界面,不明白的小伙伴打开手机便一目了然.然而这 ...

  8. 《第一行代码》学习笔记5-活动Activity(3)

    1.Menu:让菜单得到展示的同时,不占用任何屏幕的空间. public boolean onCreateOptionsMenu(Menu menu){ getMenuInflater().infla ...

  9. 17 java 存在的问题(转)

    java的问题: 1.性能:java的内存管理似乎比较自动化,但其实性能不是特别好.尤其是new对象的时候没有节制.在java中,有些对象构造成本很低,有些 很高.特别在UI编程的时候,大多数的UI对 ...

  10. JQuery实现倒计时效果

    首先:引入jquery文件 <script type="text/javascript" src="http://www.cnblogs.com/Content/P ...