Skip to content

Commit

Permalink
Paragraph: Added EndsWith(BString)
Browse files Browse the repository at this point in the history
  • Loading branch information
stippi committed Sep 20, 2015
1 parent 9a8dd79 commit 2e2ff27
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/apps/haikudepot/textview/Paragraph.cpp
Expand Up @@ -260,6 +260,17 @@ Paragraph::IsEmpty() const
}


bool
Paragraph::EndsWith(BString string) const
{
int length = Length();
int endLength = string.CountChars();
int start = length - endLength;
BString end = Text(start, endLength);
return end == string;
}


BString
Paragraph::Text() const
{
Expand Down
1 change: 1 addition & 0 deletions src/apps/haikudepot/textview/Paragraph.h
Expand Up @@ -38,6 +38,7 @@ class Paragraph {

int32 Length() const;
bool IsEmpty() const;
bool EndsWith(BString string) const;

BString Text() const;
BString Text(int32 start, int32 length) const;
Expand Down

0 comments on commit 2e2ff27

Please sign in to comment.