summaryrefslogtreecommitdiff
path: root/AK/String.h
AgeCommit message (Collapse)Author
2020-06-12AK: Make string-to-number conversion helpers return OptionalAndreas Kling
Get rid of the weird old signature: - int StringType::to_int(bool& ok) const And replace it with sensible new signature: - Optional<int> StringType::to_int() const
2020-05-30AK: Make {String,FlyString}::is_one_of() constAndreas Kling
Also, make the zero-argument variant private since it's not meant to be called by clients directly.
2020-05-26AK: Mark some popular String member functions ALWAYS_INLINEAndreas Kling
I don't wanna see String::length() in a profile, jeez. :^)
2020-05-26AK: Add case insensitive String::ends_with supportBrian Gianforcaro
FileSystemPath::has_extension was jumping through hoops and allocating memory to do a case insensitive comparison needlessly. Extend the existing String::ends_with method to allow the caller to specify the case sensitivity required.
2020-05-25AK: Add String::is_one_of(...)Andreas Kling
This allows you to compare a string against an arbitrary number of other strings with a single call.
2020-05-13AK: Replace String::trim_spaces() with String::trim_whitespace()Linus Groh
As suggested by @awesomekling in a code review and (initially) ignored by me :^) Implementation is roughly based on LibJS's trim_string(), but with a fix for trimming all-whitespace strings.
2020-05-11AK: Add String::trim_spaces()Linus Groh
2020-04-13LibELF: Add find_demangled_functionItamar
Also, added AK::String::index_of and fixed a bug in ELF::Loader::symbol_ptr
2020-04-01AK: Add String::replace() functionalityEmanuel Sprung
This adds a replace functionality that replaces a string that contains occurences of a "needle" by a "replacement" value. With "all_occurences" enabled, all occurences are being replaced, otherwise only the first occurence is being replaced.
2020-03-28AK: Add some string comparison operatorsAndreas Kling
Some of these are very inefficient. It's nice to have some optimization opportunities in the future though. :^)
2020-03-23AK: Reduce header dependency graph of String.hAndreas Kling
String.h no longer pulls in StringView.h. We do this by moving a bunch of String functions out-of-line.
2020-03-22AK: Add FlyString::to_lowercase() and LogStream operator<<(FlyString)Andreas Kling
2020-03-10AK: Add begin() and end() to String and StringViewhowar6hill
Now it's possible to use range-based for loops with String and StringView.
2020-03-08AK: Move memory stuff (fast memcpy, etc) to a separate headerAndreas Kling
Move the "fast memcpy" stuff out of StdLibExtras.h and into Memory.h. This will break a ton of things that were relying on StdLibExtras.h to include a bunch of other headers. Fix will follow immediately after. This makes it possible to include StdLibExtras.h from Types.h, which is the main point of this exercise.
2020-03-08AK: Use __builtin_memset() and such to reduce header dependenciesAndreas Kling
We can use __builtin_memset() without including <string.h>. This is pretty neat, as it will allow us to reduce the header deps of AK templates a bit, if applied consistently. Note that this is an enabling change for an upcoming #include removal.
2020-03-02AK: Move to_int(), to_uint() implementations to StringUtils (#1338)howar6hill
Provide wrappers in String and StringView. Add some tests for the implementations.
2020-03-02AK: Move the wildcard-matching implementation to StringUtilshowar6hill
Provide wrappers in the String and StringView classes, and add some tests.
2020-02-15AK: Add String starts_with(char) & ends_with(char)Shannon Booth
This is simply meant to be a more efficient implementation in the case that we only need to check a single character.
2020-02-14AK: Add a forward declaration headerAndreas Kling
You can now #include <AK/Forward.h> to get most of the AK types as forward declarations. Header dependency explosion is one of the main contributors to compile times at the moment, so this is a step towards smaller include graphs.
2020-02-13AK: Move escape_html_entities() from LibHTML to AKAndreas Kling
This sort of thing can be useful to things that don't want to link with all of LibHTML.
2020-02-10AK: Remove bitrotted Traits::dump() mechanismAndreas Kling
This was only used by HashTable::dump() which I used when doing the first HashTable implementation. Removing this allows us to also remove most includes of <AK/kstdio.h>.
2020-02-05AK: Break String::number() overloads into i/l/ll and u/ul/ullAndreas Kling
Now that we're trying to be more portable, we can't only rely on using i32/u32 and i64/u64 since different systems have different combinations of int/long/long long and unsigned/unsigned long/unsigned long long.
2020-02-05AK: Add support for 64-bit size_tjoshua stein
2020-01-22AK: Also add a keep_empty argument to String::split[_limit]()Sergey Bugaev
Just like String[View]::split_view() has already.
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2020-01-06AK+Demos+Libraries: Remove executable permissions from {.cpp,.h} filesShannon Booth
2019-12-18AK: Add String::equals_ignoring_case(StringView)Andreas Kling
2019-12-09AK: Use size_t for the length of stringsAndreas Kling
Using int was a mistake. This patch changes String, StringImpl, StringView and StringBuilder to use size_t instead of int for lengths. Obviously a lot of code needs to change as a result of this.
2019-10-28AK: Add String::contains(String)Andreas Kling
This is just a wrapper around strstr() for now. There are many better ways to search for a string within a string, but I'm just adding a nice API at the moment. :^)
2019-10-18AK: Add String::hash()Andreas Kling
2019-10-07AK: Make String compile on platforms where size_t==u32Andreas Kling
This kind of thing is a bit annoying. On Serenity, size_t is the same size as u32, but not the same type. Because of "long" or whatever. This patch makes String not complain about duplicate overloads.
2019-09-28AK: Add a keep_empty argument to String[View]::substring{_view}Sergey Bugaev
2019-09-13Revert "AK: Made Strings reversible"Andreas Kling
This reverts commit 26e81ad574d463faee19f5973108f80d0e02aaf6. We forgot to consider UTF-8 here. String is UTF-8 and we need to be careful about things like this.
2019-09-13AK: Made Strings reversibleJesse Buhagiar
`AK::String` can now be reversed via AK::String::reverse(). This makes life a lot easier for functions like `itoa()`, where the output ends up being backwards. Very much not like the normal STL (which requires an `std::reverse` object) way of doing things. A call to reverse returns a new `AK::String` so as to not upset any of the possible references to the same `StringImpl` shared between Strings.
2019-09-11AK: Add String::number(size_t) overloadAndreas Kling
2019-09-06AK: Rename <AK/AKString.h> to <AK/String.h>Andreas Kling
This was a workaround to be able to build on case-insensitive file systems where it might get confused about <string.h> vs <String.h>. Let's just not support building that way, so String.h can have an objectively nicer name. :^)
2018-12-04Import a simple text editor I started working on.Andreas Kling
2018-11-07Add a Chomp feature to String construction that removes a trailing newline.Andreas Kling
This will be useful in many situations.
2018-10-31Add getpwent() family of functions to LibC.Andreas Kling
Also add a little /etc/passwd database. There's just me in there.
2018-10-28Add a simple FileSystemPath class that can canonicalize paths.Andreas Kling
Also a simple StringBuilder to help him out.
2018-10-26Add sys$gethostname and /bin/hostnameAndreas Kling
2018-10-24Add a "pwd" utility to userland.Andreas Kling
It's implemented as a separate process. How cute is that. Tasks now have a current working directory. Spawned tasks inherit their parent task's working directory. Currently everyone just uses "/" as there's no way to chdir().
2018-10-17Integrate ext2 from VFS into Kernel.Andreas Kling
2018-10-16Add String::substring().Andreas Kling
2018-10-10Import all this stuff into a single repo called Serenity.Andreas Kling