Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: input.index(key) #7487

Closed
smol-ninja opened this issue Mar 25, 2024 · 3 comments · Fixed by #7539
Closed

Feature request: input.index(key) #7487

smol-ninja opened this issue Mar 25, 2024 · 3 comments · Fixed by #7539
Labels
T-feature Type: feature

Comments

@smol-ninja
Copy link

Vm.sol offers string manipulation functions that come in very handy when dealing with strings. In the latest versions of forge-std, the introduction of new functions such as replace has lowered our dependency on other external libraries.

However, forge-std still lacks one useful function for which foundry users may have to rely on external dependencies - a function that can return the index of the first occurrence of a key in an input string.

function index(string memory input, string memory key) external pure returns (uint256);

It would, therefore, be very useful if we could add support to it.

@mds1 mds1 transferred this issue from foundry-rs/forge-std Mar 25, 2024
@DaniPopes DaniPopes added the T-feature Type: feature label Mar 25, 2024
@kamuik16
Copy link
Contributor

kamuik16 commented Apr 3, 2024

Hey @DaniPopes! Opened a PR featuring this, review it whenever free. Thanks!

@smol-ninja
Copy link
Author

Great work @kamuik16.

@kamuik16
Copy link
Contributor

kamuik16 commented Apr 5, 2024

Great work @kamuik16.

Thanks 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-feature Type: feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants