Answered step by step
Verified Expert Solution
Question
1 Approved Answer
cpp , cannot include any includes besides xps . h ( which is this file ) / / Compare two XP strings asciibetically. / /
cpp cannot include any includes besides xpsh which is this file
Compare two XP strings "asciibetically."
Return a negative number if lhs comes before rhs
Return a positive number if lhs comes after rhs
Return zero if the two strings are equal.
int xpscompareconst char lhs const char rhs;
Create a new XP string that holds the concatenation of two XP strings.
The new string should contain all the characters
from lhs followed by all the characters from rhs
char xpsconcatconst char lhs const char rhs;
Find a substring inside another XP string.
If the substring is found, return the index of the first leftmost match.
If the substring is not found, return XPSNPOS see below
If the substring is empty, it matches at any index.
If a start index is given, only consider matches occuring
at or to the right of that index.
sizet xpsfindconst char str const char substr;
sizet xpsfindconst char str const char substr, sizet start;
Release the memory used to hold an XP string.
After calling this function, the memory pointed
to by str should no longer be used.
void xpsfreechar str;
Create a new XP string from a C string.
The new string should contain all the characters
from the C string, but stored in the XPS format.
char xpsfromcstrconst char cstr;
Get a single character from an XP string.
This function should not perform bounds checking;
assume the provided index is always in bounds.
char xpsgetcharconst char str sizet index;
Get the length of an XP string.
sizet xpslengthconst char str;
Set a single character in an XP string.
Like xpsgetchar this function should not perform
bounds checking; just assume that index is valid.
void xpssetcharchar str sizet index, char c;
Get a substring of an XP string as a new XP string.
The new string should contain all the characters from str starting at
index start and up to but not including the character at index stop.
If stop is not given, the new string should contain all the characters
from index start until the end of the original string.
If stop is past the end of the original string, only include characters
up to the end of the original string; if start is past the end of the
original string, or if stop is less than or equal to start,
return an empty string.
char xpssliceconst char str sizet start;
char xpssliceconst char str sizet start, sizet stop;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started