2019-02-04から1日間の記事一覧
sprintfで同じ値が使いたい sprintf('1. %s, 2. %s, 3. %d', 'apple', 'grape', 'apple'); こんなふうに、appleが被っている。 %dとかに数値を入れる sprintf('1. %1$s, 2. %2$s, 3. %1$s', 'apple', 'grape'); これで、 %1$sには、appleが入り、 %2$sには g…
sprintfで同じ値が使いたい sprintf('1. %s, 2. %s, 3. %d', 'apple', 'grape', 'apple'); こんなふうに、appleが被っている。 %dとかに数値を入れる sprintf('1. %1$s, 2. %2$s, 3. %1$s', 'apple', 'grape'); これで、 %1$sには、appleが入り、 %2$sには g…