X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=base%2Fstr.hh;h=79e33a1be6fc6f5273bc4455087158b39a5f5d2b;hb=690399614c3bc9ee46bee2a86b9558efbbf3b51a;hp=8fee21a1034ab6719899a946fff43d123100f27e;hpb=548b4a1cb045c6675692e8ed7c6375ebb808c803;p=gem5.git diff --git a/base/str.hh b/base/str.hh index 8fee21a10..79e33a1be 100644 --- a/base/str.hh +++ b/base/str.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003 The Regents of The University of Michigan + * Copyright (c) 2001-2005 The Regents of The University of Michigan * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -90,6 +90,20 @@ to_lower(const std::string &s) return lower; } +// Split the string s into lhs and rhs on the first occurence of the +// character c. +bool +split_first(const std::string &s, std::string &lhs, std::string &rhs, char c); + +// Split the string s into lhs and rhs on the last occurence of the +// character c. +bool +split_last(const std::string &s, std::string &lhs, std::string &rhs, char c); + +// Tokenize the string splitting on the character , and +// place the result in the string vector . If is true, +// then empty result strings (due to trailing tokens, or consecutive +// tokens) are skipped. void tokenize(std::vector &vector, const std::string &s, char token, bool ign = true);