PHP Classes

File: docs/detection-algorithm.md

Recommend this page to a friend!
  Classes of jawira   PHP Case Convert   docs/detection-algorithm.md   Download  
File: docs/detection-algorithm.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: PHP Case Convert
Convert strings between many naming conventions
Author: By
Last change:
Date: 4 years ago
Size: 825 bytes
 

Contents

Class file image Download

Detection algorithm

When \Jawira\CaseConverter\Convert class is instantiated, the input string is analysed to detect the words in it.

This is also the algorithm used by Convert::fromAuto method.

Detection algorithm

  1. If input string contains `_` (underscore character), then `_` is used to split string.
  2. If input string contains `-` (dash character), then `-` is used to split string.
  3. If input string contains `?` (space character), then `?` is used to split string.
  4. If input string contains `.` (space character), then `.` is used to split string.
  5. If input string contains uppercase characters only, then the input string is considered to be a single word.
  6. Finally, uppercase characters are used to split string.