detect comments
Finds the end of a C/C++ comment, if it exists at the current location within a string
Controller:
CodeCogs
Interface
#include <codecogs/strings/search/detect_comments.h>
using namespace Strings::Search;
| int | detect_comments (const char* str, int offset, int str_len)
Finds the end of a C/C++ comment, if it exists at the current location within a string |
These functions are available for Microsoft Excel (
Login to download):
| Integer | cc_detect_comments (String str, Integer offset, Integer str_len) |
Use the following HTML code to embed the calculators within other websites:
| Name | HTML Code |
|---|
detect_comments
Finds the end of a C/C++ comment, if it exists at the current location within a string | |
Detect Comments
This function looks for the existance of a C or C++ style comment, which starts with either "//" or "/*". Upon find either of these comment types, the function will then find the corresponding end to the comment.
There are two C/C++ comments:
- "/*" is known as a block comment and end always with a "*/". If comments are nested, this function will find the closing "*\/" that corresponds to the initial bracket, skipping over intermediate comments.
- "//" is known as a single line comment. The end is merely the end of the line.
Parameters
| str | This is the input string, with text that needs analysing. |
| offset | The location within str to search for the start of a comment. If no comment is found at str[offset] then offset is returned. |
| str_len | The length of the str to search. If you are unsure use strlen(str). |
Source Code
Source code is available when you agree to a GP Licence or buy a Commercial Licence.
Not a member, then Register with CodeCogs. Already a Member, then Login.
You must login to leave a messge