toeb / cmakepp

An Enhancement Suite for the CMake Build System
Other
432 stars 37 forks source link

Add a new function "string_set_char_at" #112

Closed ahueck closed 9 years ago

ahueck commented 9 years ago

Add a function "string_set_char_at" (and unit tests) which corresponds to "string_char_at" in order to be able to set an abritary char in a string. Indexing is identical to "string_char_at". Example call: string_set_char_at(1 "hello" a) -> returns "hallo"

toeb commented 9 years ago

Hi,

thanks again! I have a problem with the string functions - they are not consistent currently and especially string_char_at's signature is no good. I currently do not have the time but I want to change all string functions to adhere to the following interface <function name>(<subject:<string>> <other parameter>...)-><result:<any>> . Would you mind to change the interface of string_char_at and string_set_char_at` to move the index away from first position?

Also: Please rename your function to string_char_at_set I know it does not seem as intuitive as string_set_char_at but it is more consistent <subject>_<command>_<subcommand>. The Idea behind that is that to have normalized names because of missing namespaces in the cmake language (which would otherwise create problems when dealing with many functions as cmakepp does)

ahueck commented 9 years ago

I have tried to update both functions according to your suggestions. Additionally, I updated the unit tests for the existing "string_char_at" function. It consists of similar tests as the new one now. I propose to update the documentation of both in a different change set, to keep everything as consistent as possible.

toeb commented 9 years ago

well something went wrong. A lot of my string handling functions do not work any more.

toeb commented 9 years ago

alright! thanks its merged :D