JP2012141860A - ソーターソーター(別名:ア・ソータロー) - Google Patents

ソーターソーター(別名:ア・ソータロー) Download PDF

Info

Publication number
JP2012141860A
JP2012141860A JP2011000295A JP2011000295A JP2012141860A JP 2012141860 A JP2012141860 A JP 2012141860A JP 2011000295 A JP2011000295 A JP 2011000295A JP 2011000295 A JP2011000295 A JP 2011000295A JP 2012141860 A JP2012141860 A JP 2012141860A
Authority
JP
Japan
Prior art keywords
output
input
alphabet
max
textbox2
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2011000295A
Other languages
English (en)
Inventor
Shuji Itai
修二 板井
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Individual
Original Assignee
Individual
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Individual filed Critical Individual
Priority to JP2011000295A priority Critical patent/JP2012141860A/ja
Publication of JP2012141860A publication Critical patent/JP2012141860A/ja
Pending legal-status Critical Current

Links

Images

Landscapes

  • Document Processing Apparatus (AREA)

Abstract

【課題】空白や、小文字のアルファベット(a-z)にも対応する文字列ソートを提供する。
【解決手段】最初に、入力用と出力用とソート用の配列を宣言し、アルファベットの”a”から”z”までを1から26までの数字で昇順に数値を対応させる。左側のテキストボックスにアルファベットの文字を入力し、その文字列を入力用の配列に代入し、textboxに入力したデータをアルファベットの順番の数字に変換する。そして、入力したアルファベットをソートし、ソートしたデータをtextbox2の出力用のデータに変換、出力用の配列に代入していき、最後に右側のテキストボックスに出力する。
【選択図】図1

Description

本発明は、文字整列(ソート)に関するプログラムのシステムである。
ソートに関して基本的なプログラムは選択ソート、クイックソート、バブルソート等、さまざまであるが、それらのプログラムは、文字をそのまま扱うものである。
しかし、それらのソートは、処理系に依存したアルファベットをそのままソートするものであるが、本発明は、文字対応数値テーブルを用意し、その文字列に対応する数値の昇順に並べるものである。そうすることにより、文字対応数値を変更することにより、アルファベットの順番も変更できるものである。
本発明は、翻訳システムを作成しようと思って、副次的に作成られたものである。
図1はハンドスキャナの実施方法を示した説明図である。(実施例1) 図2はハンドスキャナの実施方法を示した説明図である。(実施例2)
本発明は、コンピュータ上から実行する形態である。
図1は左のテキストボックスに”bedac”を入力しSortボタンを押すと右のテキストボックスに”abcde”を出力する。
プログラム1
(ファイル名:Form1.vb)
Public Class Form1

Dim i_max As Integer '入力文字の最大値
Const alphabet_max As
Integer = 26 'アルファベットの最大文字数//
Dim input As String
'入力用の配列
Dim output As String
'出力用の配列


Dim alphabet_table() As
String = {"a",
"b", "c",
"d", "e",
"f", "g",
"h", "i",
"j", "k",
"l", "m",
"n", "o",
"p", "q",
"r", "s",
"t", "u",
"v", "w",
"x", "y",
"z", "
"}

'アルファベットを数字に変換するためのテーブル
Dim alphabet_trans_table() As
String = {"1",
"2", "3",
"4", "5",
"6", "7",
"8", "9",
"10", "11",
"12", "13",
"14", "15",
"16", "17",
"18", "19",
"20", "21",
"22", "23",
"24", "25",
"26", "99"}
'アルファベットの数字の順番に対応する文字のテーブル


Private Sub
Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load

End Sub

Private Sub
TextBox1_TextChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
TextBox1.TextChanged

input = TextBox1.Text

i_max = input.Length()
End Sub




Private Sub
Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button1.Click

Dim input_trans(i_max - 1) As
String '入力用した文字を数字に変換した配列
Dim output_trans(i_max - 1) As
String '出力用する文字に変換する数字の配列

Dim sort_temp(i_max - 1) As
String 'ソート用の配列
Dim i As Integer ' ループ用の変数
Dim j As Integer ' ループ用の変数
Dim k As Integer ' ソート用の変数

'outputの初期化

output = ""

'textboxに入力したデータをアルファベットの順番の数字に変換
For i = 0 To i_max -
1

For j = 0 To
alphabet_max

If input.Chars(i) = alphabet_table(j) Then

input_trans(i) = alphabet_table(j) : j = alphabet_max

End If

Next
Next
'入力したアルファベットをソート
k =
0
For j = 0 To
alphabet_max

For i = 0 To
i_max - 1

If input_trans(i) = alphabet_table(j) Then

sort_temp(k) = alphabet_trans_table(j) : k = k + 1

End If

Next
Next
'ソートしたデータをtextbox2の出力用のデータに変換
For i = 0 To i_max -
1

For j = 0 To
alphabet_max

If sort_temp(i) =
alphabet_trans_table(j) Then

output_trans(i) = alphabet_table(j) : j = alphabet_max

End If

Next
Next

'出力用の変数に出力する
For i = 0 To i_max -
1

output = output & output_trans(i)
Next

'テキストボックスに出力

TextBox2.Text = output

End Sub


Private Sub
TextBox2_TextChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
TextBox2.TextChanged

End Sub


Private Sub
Button2_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button2.Click
End
End Sub
End Class
プログラム2

(ファイル名:Form1designer.vb)
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
_
Partial Class Form1
Inherits System.Windows.Forms.Form

'フォームがコンポーネントの一覧をクリーンアップするために
dispose をオーバーライドします。

<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal
disposing As Boolean)
Try

If disposing AndAlso
components IsNot Nothing
Then

components.Dispose()

End If
Finally

MyBase.Dispose(disposing)
End Try
End Sub

'Windows フォーム デザイナで必要です。
Private components As
System.ComponentModel.IContainer

'メモ: 以下のプロシージャは Windows フォーム デザイナで必要です。
'Windows フォーム デザイナを使用して変更できます。
'コード エディタを使って変更しないでください。

<System.Diagnostics.DebuggerStepThrough()> _
Private Sub
InitializeComponent()
Me.TextBox1 = New
System.Windows.Forms.TextBox
Me.TextBox2 = New
System.Windows.Forms.TextBox
Me.Button1 = New
System.Windows.Forms.Button
Me.Button2 = New
System.Windows.Forms.Button
Me.SuspendLayout()
'

'TextBox1
'
Me.TextBox1.Location = New
System.Drawing.Point(12, 58)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New
System.Drawing.Size(110, 19)
Me.TextBox1.TabIndex = 0
'TextBox2
'
Me.TextBox2.Location = New
System.Drawing.Point(170, 58)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New
System.Drawing.Size(110, 19)
Me.TextBox2.TabIndex = 1
'
'Button1
'
Me.Button1.Location = New
System.Drawing.Point(90, 145)
Me.Button1.Name = "Button1"
Me.Button1.Size = New
System.Drawing.Size(110, 23)
Me.Button1.TabIndex = 2
Me.Button1.Text = "Sort"
Me.Button1.UseVisualStyleBackColor = True

'
'Button2
'
Me.Button2.Location = New
System.Drawing.Point(90, 197)
Me.Button2.Name = "Button2"
Me.Button2.Size = New
System.Drawing.Size(110, 23)
Me.Button2.TabIndex = 4
Me.Button2.Text = "End"
Me.Button2.UseVisualStyleBackColor = True
'
'Form1
'
Me.AutoScaleDimensions = New
System.Drawing.SizeF(6.0!, 12.0!)
Me.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(292,
266)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
Me.PerformLayout()

End Sub
Friend WithEvents
TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents
TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents
Button1 As System.Windows.Forms.Button
Friend WithEvents Button2
As System.Windows.Forms.Button

End Class

'
図2は左のテキストボックスに”edcba”を入力しSortボタンを押すと右のテキストボックスに”abcde”を出力する
子供用のゲームや、不規則文字列の並べ替え、処理系に依存しない並べ替えに利用できる。
プログラムファイルの末尾にべつの別の場所の ‘ が付いている。


(0010)

(ファイル名:Form1.vb)
Public Class Form1

Dim
i_max As Integer '入力文字の最大値
Const
alphabet_max As Integer
= 26 'アルファベットの最大文字数//
Dim
input As String
'入力用の配列
Dim
output As String
'出力用の配列


Dim
alphabet_table() As String
= {"a", "b",
"c", "d",
"e", "f",
"g", "h",
"i", "j",
"k", "l",
"m", "n",
"o", "p",
"q", "r",
"s", "t",
"u", "v",
"w", "x",
"y", "z",
" "}

'アルファベットを数字に変換するためのテーブル
Dim
alphabet_trans_table() As String = {"1",
"2", "3",
"4", "5",
"6", "7",
"8", "9",
"10", "11",
"12", "13",
"14", "15",
"16", "17",
"18", "19",
"20", "21",
"22", "23",
"24", "25",
"26", "99"}
'アルファベットの数字の順番に対応する文字のテーブル


Private
Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

End
Sub

Private
Sub TextBox1_TextChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged

input = TextBox1.Text

i_max = input.Length()
End
Sub




Private
Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim input_trans(i_max - 1) As
String '入力用した文字を数字に変換した配列
Dim output_trans(i_max - 1) As
String '出力用する文字に変換する数字の配列

Dim sort_temp(i_max - 1) As
String 'ソート用の配列
Dim i As Integer ' ループ用の変数
Dim j As Integer ' ループ用の変数
Dim k As Integer ' ソート用の変数

'outputの初期化

output = ""

'textboxに入力したデータをアルファベットの順番の数字に変換
For i = 0 To i_max -
1

For j = 0 To
alphabet_max

If input.Chars(i) = alphabet_table(j) Then

input_trans(i) = alphabet_table(j) : j = alphabet_max

End If

Next
Next
'入力したアルファベットをソート
k =
0
For j = 0 To
alphabet_max

For i = 0 To
i_max - 1

If input_trans(i) = alphabet_table(j) Then

sort_temp(k) = alphabet_trans_table(j) : k = k + 1

End If

Next
Next
'ソートしたデータをtextbox2の出力用のデータに変換
For i = 0 To i_max -
1

For j = 0 To
alphabet_max

If sort_temp(i) =
alphabet_trans_table(j) Then

output_trans(i) = alphabet_table(j) : j = alphabet_max

End If
Next
Next

'出力用の変数に出力する
For i = 0 To i_max -
1

output = output & output_trans(i)
Next

'テキストボックスに出力

TextBox2.Text = output

End
Sub


Private
Sub TextBox2_TextChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles TextBox2.TextChanged

End
Sub


Private
Sub Button2_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
End
End
Sub
End Class



(0011)

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
_
Partial Class Form1
Inherits
System.Windows.Forms.Form

'フォームがコンポーネントの一覧をクリーンアップするために dispose をオーバーライドします。

<System.Diagnostics.DebuggerNonUserCode()> _
Protected
Overrides Sub Dispose(ByVal disposing As Boolean)
Try

If disposing AndAlso
components IsNot Nothing
Then

components.Dispose()

End If
Finally

MyBase.Dispose(disposing)
End Try
End
Sub

'Windows
フォーム デザイナで必要です。
Private
components As System.ComponentModel.IContainer

'メモ: 以下のプロシージャは Windows フォーム デザイナで必要です。
'Windows
フォーム デザイナを使用して変更できます。
'コード エディタを使って変更しないでください。

<System.Diagnostics.DebuggerStepThrough()> _
Private
Sub InitializeComponent()
Me.TextBox1 = New
System.Windows.Forms.TextBox
Me.TextBox2 = New
System.Windows.Forms.TextBox
Me.Button1 = New
System.Windows.Forms.Button
Me.Button2 = New
System.Windows.Forms.Button
Me.SuspendLayout()
'
'TextBox1
'
Me.TextBox1.Location = New
System.Drawing.Point(12, 58)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New
System.Drawing.Size(110, 19)
Me.TextBox1.TabIndex = 0
'
'TextBox2
'
Me.TextBox2.Location = New
System.Drawing.Point(170, 58)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New
System.Drawing.Size(110, 19)
Me.TextBox2.TabIndex = 1
'
'Button1
'
Me.Button1.Location = New
System.Drawing.Point(90, 145)
Me.Button1.Name = "Button1"
Me.Button1.Size = New
System.Drawing.Size(110, 23)
Me.Button1.TabIndex = 2
Me.Button1.Text = "Sort"
Me.Button1.UseVisualStyleBackColor = True
'
'Button2
'
Me.Button2.Location = New
System.Drawing.Point(90, 197)
Me.Button2.Name = "Button2"
Me.Button2.Size = New
System.Drawing.Size(110, 23)
Me.Button2.TabIndex = 4
Me.Button2.Text = "End"
Me.Button2.UseVisualStyleBackColor = True
'
'Form1
'
Me.AutoScaleDimensions = New
System.Drawing.SizeF(6.0!, 12.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New
System.Drawing.Size(292, 266)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Name = "Form1"
Me.Text
= "Form1"
Me.ResumeLayout(False)
Me.PerformLayout()

End
Sub
Friend
WithEvents TextBox1 As
System.Windows.Forms.TextBox
Friend
WithEvents TextBox2 As
System.Windows.Forms.TextBox
Friend
WithEvents Button1 As
System.Windows.Forms.Button
Friend
WithEvents Button2 As
System.Windows.Forms.Button

End Class

Claims (1)

  1. VisualBasic(VisualStudio2008)を使用し、ウィンドウ内の左のテキストボックスに文字を入力し、右のテキストボックスに文字整列(ソート)後の結果を表示するシステムである。ウィンドウ内にSort(文字整列)ボタンとEnd(終了)ボタンがある。
JP2011000295A 2011-01-05 2011-01-05 ソーターソーター(別名:ア・ソータロー) Pending JP2012141860A (ja)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2011000295A JP2012141860A (ja) 2011-01-05 2011-01-05 ソーターソーター(別名:ア・ソータロー)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2011000295A JP2012141860A (ja) 2011-01-05 2011-01-05 ソーターソーター(別名:ア・ソータロー)

Publications (1)

Publication Number Publication Date
JP2012141860A true JP2012141860A (ja) 2012-07-26

Family

ID=46678079

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2011000295A Pending JP2012141860A (ja) 2011-01-05 2011-01-05 ソーターソーター(別名:ア・ソータロー)

Country Status (1)

Country Link
JP (1) JP2012141860A (ja)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1998043359A1 (fr) * 1997-03-24 1998-10-01 Advantest Corporation Procede et dispositif de compression et de decompression de configuration binaire

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1998043359A1 (fr) * 1997-03-24 1998-10-01 Advantest Corporation Procede et dispositif de compression et de decompression de configuration binaire

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JPN6013052058; 川口輝久: かんたんプログラミング Visual Basic 2005[基礎編] 初版, 20070925, 74,118〜122, 株式会社技術評論社

Similar Documents

Publication Publication Date Title
JP7169389B2 (ja) 文書タイトルツリーの構築方法、装置、電子設備、記憶媒体、及びプログラム
CN111488441B (zh) 问题解析方法、装置、知识图谱问答系统和电子设备
CN104571587B (zh) 对输入法的上屏候选项进行筛选的方法和装置
US20210397791A1 (en) Language model training method, apparatus, electronic device and readable storage medium
CN110276456A (zh) 一种机器学习模型辅助构建方法、系统、设备及介质
CN111078878B (zh) 文本处理方法、装置、设备及计算机可读存储介质
CN111738015B (zh) 文章情感极性分析方法、装置、电子设备及存储介质
CN112560499B (zh) 语义表示模型的预训练方法、装置、电子设备及存储介质
CN112115313B (zh) 正则表达式的生成、数据提取方法、装置、设备及介质
CN109388402A (zh) 基于Android平台的轻量级Josn格式解析工具
CN105550535A (zh) 一种基因字符序列快速编码为二进制序列的编码方法
CN111460801B (zh) 标题生成方法、装置及电子设备
CN110909390B (zh) 一种任务审核方法、装置、电子设备及存储介质
Yue Transition from EBNF to Xtext
JP2012141860A (ja) ソーターソーター(別名:ア・ソータロー)
Radhakrishnan et al. Huffman coding and decoding using Android
Amrit et al. A social network perspective of Conway’s law
Rama et al. A computational algorithm for metrical classification of verse
JP2012226697A (ja) Wbs作成システムおよびwbs作成方法
JP3208635U (ja) 切替式漢字組立システム
CN105554543B (zh) 基于遥控器的拼音输入法及其系统
Gwagwa et al. Minimizing algorithmic bias and discrimination in the digital economy
Groner Learning javaScript data structures and algorithms
CN106062745A (zh) 用于安全的信息存储的方法和装置
US20160232030A1 (en) Electronic official document processing method

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20121225

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20130513