FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
rustpython-unparser/src/utils.rs at dev · jvllmr/rustpython-unparser · GitHub
jvllmr
/
rustpython-unparser
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Actions
Security and quality
0
Insights
Additional navigation options
Code
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
rustpython-unparser
/
src
/
utils.rs
Copy path
More file actions
More file actions
Latest commit
History
History
History
9 lines (7 loc) · 249 Bytes
Breadcrumbs
rustpython-unparser
/
src
/
utils.rs
Copy path
File metadata and controls
9 lines (7 loc) · 249 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
pub
fn
replace_first_and_last
(
s
:
&
str
,
replacement
:
&
str
)
->
String
{
if
s
.
len
(
)
<=
1
{
return
replacement
.
to_string
(
)
+ replacement
;
}
let
middle =
&
s
[
1
..s
.
len
(
)
-
1
]
;
format
!
(
"{}{}{}"
,
replacement
,
middle
,
replacement
)
}
Back
|
FazBrowse Home
|
New Git URL