Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some string functions #278

Merged
merged 5 commits into from
Jul 1, 2023

Conversation

puripuri2100
Copy link
Collaborator

追加した関数は以下の通りです:

  • with-concat : string -> string list -> string:区切り文字を指定した文字リスト結合
  • cat : string -> string -> string:文字結合
  • make : int -> Char.t -> string:文字列生成
  • init : int -> (int -> Char.t) -> string:文字列生成
  • get : int -> string -> Char.t option:位置を指定した文字取得
  • contains : string -> string -> bool:部分文字列判定
  • trim : string -> string:空白削除
  • trim-start : string -> string:空白削除
  • trim-end : string -> string:空白削除
  • uppercase-ascii : string -> string:大文字化
  • lowercase-ascii : string -> string:小文字化
  • capitalize-ascii : string -> string:先頭の大文字化
  • uncapitalize-ascii : string -> string:先頭の小文字化

@puripuri2100 puripuri2100 changed the title Add some functions Add some string functions Mar 21, 2023
Copy link
Collaborator

@zeptometer zeptometer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

大きな修正は必要ないと思います(containsの実装だけ後でちゃんと確認します)

あとこれは前提の確認なのですが、このあたりの関数はどのような基準で追加しましたか?(外部のライブラリを参考にした or 自分が使って欲しいものを追加した あたりでしょうか)

src/string.satyg Show resolved Hide resolved
src/string.satyg Outdated Show resolved Hide resolved
src/string.satyg Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

テスト追加ありがとうございます!

@puripuri2100
Copy link
Collaborator Author

指摘ありがとうございます。後で確認して修正します。
関数の追加基準ですが、OCamlとRustの標準の文字列操作ライブラリで提供されている関数のうち、SATySFiで簡単に実装できそうなものを全部実装した感じになります(例えばRustのto_uppercaseは実装が単純にはいかなさそうなので実装をしていない)

@zeptometer
Copy link
Collaborator

なるほど、それで ascii に限定した実装になっているんですね(unicodeへの対応は確かに面倒くさそうだ…)
了解です、ありがとうございます 🙇

src/string.satyg Outdated Show resolved Hide resolved
src/string.satyg Outdated Show resolved Hide resolved
src/string.satyg Outdated Show resolved Hide resolved
@zeptometer
Copy link
Collaborator

あと2つコメントが残っているので見てもらってもいいですか?よろしくお願いします。

@zeptometer
Copy link
Collaborator

よいと思います、ありがとうございます 🙏

@puripuri2100 puripuri2100 merged commit 859a6c7 into nyuichi:master Jul 1, 2023
3 checks passed
This was referenced Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants