Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

Borrowing from amramr's answer herehere

ToExpression["16^^" <> #] & /@ 
   Partition[Characters@StringTrim[#, "#"], 2] & /@ {"FFFFFF", 
  "#FFFFFF", "000000", "#FF5500", "#005500"}

=>{{255, 255, 255}, {255, 255, 255}, {0, 0, 0}, {255, 85, 0}, {0, 85, 0}}

Borrowing from amr's answer here

ToExpression["16^^" <> #] & /@ 
   Partition[Characters@StringTrim[#, "#"], 2] & /@ {"FFFFFF", 
  "#FFFFFF", "000000", "#FF5500", "#005500"}

=>{{255, 255, 255}, {255, 255, 255}, {0, 0, 0}, {255, 85, 0}, {0, 85, 0}}

Borrowing from amr's answer here

ToExpression["16^^" <> #] & /@ 
   Partition[Characters@StringTrim[#, "#"], 2] & /@ {"FFFFFF", 
  "#FFFFFF", "000000", "#FF5500", "#005500"}

=>{{255, 255, 255}, {255, 255, 255}, {0, 0, 0}, {255, 85, 0}, {0, 85, 0}}

deleted 65 characters in body
Source Link
user1066
  • 22.7k
  • 3
  • 36
  • 59

Borrowing from amr's answer here

(ToExpression[
      "16^^"ToExpression["16^^" <> #] &) /@ (StringTake[#, 
       Partition[Range@StringLength@#, 2, 2, 1Partition[Characters@StringTrim[#, {}]] &)@
    StringTrim[#"#"], "#"]2] & /@ {"FFFFFF", 
  "#FFFFFF", "000000", "#FF5500",
   "FF5500""#005500"}

=>  {{255, 255, 255}, {255, 255, 255}, {0, 0, 0}, {255, 85, 0}, {2550, 85, 0 0}}

Borrowing from amr's answer here

(ToExpression[
      "16^^" <> #] &) /@ (StringTake[#, 
       Partition[Range@StringLength@#, 2, 2, 1, {}]] &)@
    StringTrim[#, "#"] & /@ {"FFFFFF", "#FFFFFF", "000000", "#FF5500",
   "FF5500"}

=>  {{255, 255, 255}, {255, 255, 255}, {0, 0, 0}, {255, 85, 0}, {255, 85, 0}}

Borrowing from amr's answer here

ToExpression["16^^" <> #] & /@ 
   Partition[Characters@StringTrim[#, "#"], 2] & /@ {"FFFFFF", 
  "#FFFFFF", "000000", "#FF5500", "#005500"}

=>{{255, 255, 255}, {255, 255, 255}, {0, 0, 0}, {255, 85, 0}, {0, 85, 0}}

StringTrim used instead of StringDrop
Source Link
user1066
  • 22.7k
  • 3
  • 36
  • 59

Borrowing from amr's answer here

(ToExpression[
      "16^^" <> #] &) /@ (StringTake[#, 
       Partition[Range@StringLength@#, 2, 2, 1, {}]] &)@
    StringDrop[#StringTrim[#, 1]"#"] & /@ {"#FF5500""FFFFFF", "#FFFFFF", "#FF0000""000000", "#FF5500",
   "FF5500"}

=> {{255, 85255, 0255}, {255, 255, 255}, {0, 0, 0}, {255, 85, 0}, {255, 85, 0}}

Borrowing from amr's answer here

(ToExpression[
      "16^^" <> #] &) /@ (StringTake[#, 
       Partition[Range@StringLength@#, 2, 2, 1, {}]] &)@
    StringDrop[#, 1] & /@ {"#FF5500", "#FFFFFF", "#FF0000"}

=> {255, 85, 0}, {255, 255, 255}, {255, 0, 0}}

Borrowing from amr's answer here

(ToExpression[
      "16^^" <> #] &) /@ (StringTake[#, 
       Partition[Range@StringLength@#, 2, 2, 1, {}]] &)@
    StringTrim[#, "#"] & /@ {"FFFFFF", "#FFFFFF", "000000", "#FF5500",
   "FF5500"}

=> {{255, 255, 255}, {255, 255, 255}, {0, 0, 0}, {255, 85, 0}, {255, 85, 0}}

Source Link
user1066
  • 22.7k
  • 3
  • 36
  • 59
Loading