# \#string

**URL:** https://discuss.ocaml.org/tag/string/80.md

[Latest](https://discuss.ocaml.org/latest.md) · [Categories](https://discuss.ocaml.org/categories.md) · [Tags](https://discuss.ocaml.org/tags.md)

---

## [Adding indexed variants of all functions in stdlib](https://discuss.ocaml.org/t/adding-indexed-variants-of-all-functions-in-stdlib/12792)

<div class="topic-metadata">

**Author:** [@glen](https://discuss.ocaml.org/u/glen)\
**Replies:** 6\
**Last updated:** [August 11, 2023, 9:26am UTC](https://discuss.ocaml.org/t/adding-indexed-variants-of-all-functions-in-stdlib/12792 "2023-08-11T09:26:21Z")

</div>

I am thinking of adding index-aware variants of existing functions to the standard library. For instance, List.map has an indexed variant named List.mapi. Currently, only a minority of standard functions for which it wou…

---

## [Different regex rule between Python & OCaml (kinda) confuses me lol](https://discuss.ocaml.org/t/different-regex-rule-between-python-ocaml-kinda-confuses-me-lol/11827)

<div class="topic-metadata">

**Author:** [@anzhi0708](https://discuss.ocaml.org/u/anzhi0708)\
**Replies:** 3\
**Last updated:** [March 30, 2023, 3:15am UTC](https://discuss.ocaml.org/t/different-regex-rule-between-python-ocaml-kinda-confuses-me-lol/11827 "2023-03-30T03:15:03Z")

</div>

In Python, if you want to match literal parentheses, you need to escape them Python 3.11.2 (main, Feb 16 2023, 03:20:12) \[Clang 13.0.0 (clang-1300.0.29.30)\] on darwin Type "help", "copyright", "credits" or "license" for…

---

## [\[help\] Regex pattern and raw strings](https://discuss.ocaml.org/t/help-regex-pattern-and-raw-strings/11747)

<div class="topic-metadata">

**Author:** [@anzhi0708](https://discuss.ocaml.org/u/anzhi0708)\
**Replies:** 2\
**Last updated:** [March 22, 2023, 7:44pm UTC](https://discuss.ocaml.org/t/help-regex-pattern-and-raw-strings/11747 "2023-03-22T19:44:50Z")

</div>

Hello folks! Another day, another noob question. Help wanted :3 I wrote this function to remove every ‘\\n’ in the string. let remove\_newlines (str : string) : string = Str.global\_replace (Str.regexp "\\n") "" str B…

---

## [This is my first OCaml program. Advices for improvement?](https://discuss.ocaml.org/t/this-is-my-first-ocaml-program-advices-for-improvement/11739)

<div class="topic-metadata">

**Author:** [@anzhi0708](https://discuss.ocaml.org/u/anzhi0708)\
**Replies:** 3\
**Last updated:** [March 21, 2023, 5:48pm UTC](https://discuss.ocaml.org/t/this-is-my-first-ocaml-program-advices-for-improvement/11739 "2023-03-21T17:48:13Z")

</div>

So it removes '\\n’s from clipboard buffer, so I can paste the content to any translation software later. If I don’t remove the NEWLINEs, the translator softwares could give me wrong translations let () = print\_endline "…

---

## [【Q】fd, channel, flush & buffer](https://discuss.ocaml.org/t/q-fd-channel-flush-buffer/11737)

<div class="topic-metadata">

**Author:** [@anzhi0708](https://discuss.ocaml.org/u/anzhi0708)\
**Replies:** 1\
**Last updated:** [March 21, 2023, 8:35am UTC](https://discuss.ocaml.org/t/q-fd-channel-flush-buffer/11737 "2023-03-21T08:35:54Z")

</div>

Hello! Thanks to you guys’ support, I’m getting more and more comfortable with coding in OCaml! I need to copy & paste text from raw PDF files for my homework; you might already know that when you do that, random newlin…

---

## [Simplify roman utf8](https://discuss.ocaml.org/t/simplify-roman-utf8/4398)

<div class="topic-metadata">

**Author:** [@sanette](https://discuss.ocaml.org/u/sanette)\
**Replies:** 40\
**Last updated:** [May 31, 2022, 5:22pm UTC](https://discuss.ocaml.org/t/simplify-roman-utf8/4398 "2022-05-31T17:22:32Z")

</div>

Hello is there a library (or a simple way) to “remove accents” from a string containing an UTF8 encoded word from a language using the roman alphabet + diacritics? I mean; removing diacritics to obtain ascii. For inst…

---

## [Best practice for performant string operation?](https://discuss.ocaml.org/t/best-practice-for-performant-string-operation/9345)

<div class="topic-metadata">

**Author:** [@bn-d](https://discuss.ocaml.org/u/bn-d)\
**Replies:** 8\
**Last updated:** [February 17, 2022, 9:48pm UTC](https://discuss.ocaml.org/t/best-practice-for-performant-string-operation/9345 "2022-02-17T21:48:57Z")

</div>

I recently received this comment (thanks!) for a package I published. It is honestly something I never think of before. str\_1 ^ str\_2 ^ str\_3 ^ str\_4 ^ str\_5 This code seems innocent and clean. But if you look at ^ u…

---

## [How to convert string to type "regexp"?](https://discuss.ocaml.org/t/how-to-convert-string-to-type-regexp/5965)

<div class="topic-metadata">

**Author:** [@HoraDeComer](https://discuss.ocaml.org/u/HoraDeComer)\
**Replies:** 4\
**Last updated:** [June 22, 2020, 9:06am UTC](https://discuss.ocaml.org/t/how-to-convert-string-to-type-regexp/5965 "2020-06-22T09:06:51Z")

</div>

I got this type: type regexp = | V ( \* void \* ) | E ( \* epsilon \* ) | C of char ( \* char \*…

---

## [Convert CamelCase string to Capitalized\_snake\_case without regex](https://discuss.ocaml.org/t/convert-camelcase-string-to-capitalized-snake-case-without-regex/774)

<div class="topic-metadata">

**Author:** [@cedlemo](https://discuss.ocaml.org/u/cedlemo)\
**Replies:** 17\
**Last updated:** [September 1, 2017, 8:31am UTC](https://discuss.ocaml.org/t/convert-camelcase-string-to-capitalized-snake-case-without-regex/774 "2017-09-01T08:31:05Z")

</div>

in order to improve myself, I would like to know if you find something wrong with the following function or what I can improve in it: edit : the following function has been modified in order to not raise an exception In…
