Documentation
¶
Overview ¶
Package inspect provides general-purpose string predicates and position scanners used across ctx packages.
Index ¶
- func Contains(content, substr string) (bool, int)
- func ContainsEndComment(content string) (bool, int)
- func ContainsNewLine(content string) (bool, int)
- func EndsWithNewline(s string) bool
- func FindNewline(s string) int
- func SkipNewline(s string, pos int) int
- func SkipWhitespace(s string, pos int) int
- func StartsWithCtxMarker(s string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
Contains reports whether content contains the substring and returns its index.
Parameters:
- content: String to search in
- substr: Substring to find
Returns:
- bool: True if substr is found
- int: Index of substr (-1 if not found)
func ContainsEndComment ¶
ContainsEndComment reports whether content contains a comment close marker.
Parameters:
- content: String to search in
Returns:
- bool: True if comment close marker is found
- int: Index of marker (-1 if not found)
func ContainsNewLine ¶
ContainsNewLine reports whether content contains a newline and returns its index.
Parameters:
- content: String to search in
Returns:
- bool: True if a newline is found
- int: Index of newline (-1 if not found)
func EndsWithNewline ¶
EndsWithNewline reports whether s ends with a newline (CRLF or LF).
Parameters:
- s: String to check
Returns:
- bool: True if s ends with a newline
func FindNewline ¶
FindNewline returns the index of the first newline (CRLF or LF) in s.
Parameters:
- s: String to search
Returns:
- int: Index of the first newline (-1 if not found)
func SkipNewline ¶
SkipNewline advances pos past a newline (CRLF or LF) if present.
Parameters:
- s: String to scan
- pos: Current position in s
Returns:
- int: New position (unchanged if no newline at pos)
func SkipWhitespace ¶
SkipWhitespace advances pos past any whitespace (space, tab, newline).
Parameters:
- s: String to scan
- pos: Current position in s
Returns:
- int: New position after skipping whitespace
func StartsWithCtxMarker ¶
StartsWithCtxMarker reports whether s starts with a ctx marker comment.
Parameters:
- s: String to check
Returns:
- bool: True if s starts with CtxMarkerStart or CtxMarkerEnd
Types ¶
This section is empty.