Delete the 4 last digits of a message

1 Ansicht (letzte 30 Tage)
flashpode
flashpode am 14 Jul. 2021
Kommentiert: flashpode am 14 Jul. 2021
what I am tryng to do is to delete the las 4 digits of a message and I do not how to do it for a big amount of messages. the type of messages that I have have number comas and leters but the last are numbers and always diferent. I am thinking of using this functions:
fname
Please help.

Antworten (1)

KSSV
KSSV am 14 Jul. 2021
Bearbeitet: KSSV am 14 Jul. 2021
str = 'Hello World'
str = 'Hello World'
str(end-3:end) = []
str = 'Hello W'
  3 Kommentare
Walter Roberson
Walter Roberson am 14 Jul. 2021
output = regexprep(AIS1, '\d\d\d\d$', '')
This will delete the last 4 characters provided they are digits. It does not "delete the last four digits", so it would leave "ABC12345D" unchanged, and likewise it would leave "AB123D45" unchanged where "last four digits" would require "AB1D" as output
flashpode
flashpode am 14 Jul. 2021
really useful thank youuu

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by