Skip to main content
added 22 characters in body
Source Link
Kuba
  • 137.7k
  • 13
  • 289
  • 751
f = "string" <> ToString[#] &

or, if you have 10+:

f = StringTemplate["string``"]

Can't find a duplicate, so:

list = Range@10;
list[[;; ;; 3]] = f /@ list[[;; ;; 3]];

list
{"string1", 2, 3, "string4", 5, 6, "string7", 8, 9, "string10"}

Or:

list = Range@10;

MapAt[
 f,
 list,
 {;; ;; 3}
]
f = "string" <> ToString[#] &

or, if you have 10+:

f = StringTemplate["string``"]

Can't find a duplicate, so:

list[[;; ;; 3]] = f /@ list[[;; ;; 3]];

list
{"string1", 2, 3, "string4", 5, 6, "string7", 8, 9, "string10"}

Or:

list = Range@10;

MapAt[
 f,
 list,
 {;; ;; 3}
]
f = "string" <> ToString[#] &

or, if you have 10+:

f = StringTemplate["string``"]

Can't find a duplicate, so:

list = Range@10;
list[[;; ;; 3]] = f /@ list[[;; ;; 3]];

list
{"string1", 2, 3, "string4", 5, 6, "string7", 8, 9, "string10"}

Or:

list = Range@10;

MapAt[
 f,
 list,
 {;; ;; 3}
]
Source Link
Kuba
  • 137.7k
  • 13
  • 289
  • 751

f = "string" <> ToString[#] &

or, if you have 10+:

f = StringTemplate["string``"]

Can't find a duplicate, so:

list[[;; ;; 3]] = f /@ list[[;; ;; 3]];

list
{"string1", 2, 3, "string4", 5, 6, "string7", 8, 9, "string10"}

Or:

list = Range@10;

MapAt[
 f,
 list,
 {;; ;; 3}
]